CSS 垂直间距问题(边距?) - 两个 Div 之间的垂直间距
我的网站布局已经基本完成。在域上,我正在测试此布局 - http://networkgenius.org/ - 有一个垂直空间将内容包装 div 和菜单 div 分开。我将垂直间距的边距设置为 0px,这是唯一像这样分开的区域。
我希望白色内容区域被压在菜单底部,这样它们之间就不会显示正文的背景。
我做错了什么?
I've got the layout of my site mostly done. On the domain I'm testing this layout on - http://networkgenius.org/ - there is a vertical space separating the content-wrapper div and the menu div. I have the margins set to 0px for the vertical spacing, and this is the only area that is separated like it is.
I'd like the white content area to be pressed up right against the bottom of the menu, so that none of the body's background shows between them.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的导航栏 (
#nav, #nav ul
) 的高度为35px
,但看起来背景图像实际上并没有那么高,而且因为您似乎已将其设置为仅具有透明
颜色的repeat-x
,您将获得该空间。将其设置为
27px
或更小,就可以了(至少在 Chrome 中)。Your navigation bar (
#nav, #nav ul
) has a height of35px
on it, but it seems like the background image isn't actually that tall, and since you seem to have set it to onlyrepeat-x
with atransparent
color, you'll get that space.Set it to
27px
or smaller and you'll be fine (in Chrome, at least).杰夫是对的。您的 #nav ul 的高度大于导航栏(和背景图像)。此外,导航 ul 上还有垂直填充,这也增加了差异。
Jeff is right. Your #nav ul has a height larger than your navbar (and background image). Also, there is vertical padding on the nav ul as well that adds to the discrepancy.