CSS 居中问题 - Div 居中 appx 15px 离右侧太远
我正在为我的网站修改一个主题。目前,我将它放在我的测试域中,同时在发布前对其进行修改。
#content-wrap div 居中,但离右侧太远由于某种原因。我完全不知道为什么要这样做,特别是因为其他一切都正确居中。问题是什么?
我确实在内容包装区域添加了 15 像素的填充,因为我已将正文的背景颜色更改为您看到的灰色,并且显然不希望文本直接压在包装的边缘上。
感谢您的帮助!
-苏塔
I have a theme that I'm modifying for my site. I currently have it live on my test domain while I tinker with it before launch.
The #content-wrap div is centering, but too far to the right for some reason. I've absolutely no idea why it's doing this, especially since everything else is centering properly. What is the problem?
I did add a 15px padding to the content-wrap area as I've changed the body's background color to the grey that you see and obviously didn't want the text pressed right up against the edges of the wrapper.
Thanks for your help!
-Sootah
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为“content-wrap”div 是“content”div 的包装器。
包装器的宽度为 980 像素,内容的宽度为 980 像素。
到目前为止一切都很好。内容两侧的内边距均为 15 像素。这会使其宽度有效地增加 30px,使其变为 1010px。
这个额外的宽度使其向右移动。
将内容的宽度减小到 950 像素。或者去掉填充物。
这应该有效。
I suppose the "content-wrap" div is a wrapper for "content" div.
The wrapper has a width of 980px and the content has a width of 980px.
All is well till now. The content has padding of 15px on both sides. This adds 30px to it's width effectively making it 1010px
This extra width makes it move to the right.
Reduce the width of the content to 950px. Or remove the padding.
This should work.
您在 div#content 上有填充。将其更改为
(你有萤火虫,对吧?)
You have padding on div#content. Change it to
(You have firebug, right?)