图库不会以页面为中心

发布于 2024-12-17 22:23:55 字数 233 浏览 4 评论 0原文

我正在尝试将我的画廊阵列居中。我尝试过:

  • margin-left:auto;右边距:自动 和
  • 保证金:0 自动; 和 -文本对齐:居中;

并没有运气?

这是链接

非常感谢任何帮助! 谢谢。

I am trying to center my gallery array. I tried:

  • margin-left:auto; margin-right:auto
    and
  • margin:0 auto;
    and
    -text-align:center;

and have had no luck?

Here is the link

Any help is greatly appreciated!
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久夏青 2024-12-24 22:23:55

这是你的问题:

#content ul {
padding: 0 0 16px 30px;
}

它是居中对齐的,但你在 ul 上有左填充(30px)

将其更改为 0px 将使画廊居中对齐:

#content ul {
    padding: 0 0 16px 0;
}

我不确定这会产生什么影响在其他元素上,所以也许只为画廊创建第二个类:

#content ul.gallery {
    padding-left:0;
}

This is your problem:

#content ul {
padding: 0 0 16px 30px;
}

It is center aligned, but you've got left padding on the ul (30px)

Changing this to 0px will center align the gallery:

#content ul {
    padding: 0 0 16px 0;
}

I'm not sure what implications this will have on other elements, so perhaps create a second class just for the gallery:

#content ul.gallery {
    padding-left:0;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文