2 个垂直放置的 div,什么可以阻止它们“接触”?
Click here to see what I mean.. What could prevent these two from sitting directly atop each other like that. At the moment on my site I have to use margin-bottom:-22px;
to get the effect.
And of course, it doesn't work in IE...
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
也许是一些继承的利润?没有上下文很难知道。
识别此类问题的有用工具是大多数浏览器中称为“开发人员工具”(Firefox 中的 Firebug)的工具。右键单击任何元素并选择
检查元素
,以便轻松查看任何元素的盒模型以及它从何处获取这些样式。以下是有关如何使用 Firebug 执行此操作的一些链接:http://getfirebug.com/layout 和 http://getfirebug.com/css
Some inherited margin, perhaps? It's very hard to know without the context.
A useful tool to identify problems of this type is what is known in most browsers as "developer tools" (Firebug in Firefox). Right click on any element and choose
Inspect element
in order to easily view the box model of any element, and from where it has acquired those styles.Here's some links on how to do this with Firebug: http://getfirebug.com/layout and http://getfirebug.com/css
也许在内部浏览器样式中或样式表中的其他地方定义了边距?尝试将两个元素的边距都设置为 0。
Maybe there is a margin defined somewhere, either in the internal browser styles or elsewhere in your stylesheet? Try setting the margin to 0 on both elements.
使用正的边距值应该会导致它们间隔更远
Using a positive margin value should result in them being spaced further apart
你是什么意思?如果将
margin-top: 2px
添加到底部 div,它将显示为向下 2px,即不接触。这有什么问题吗...?What do you mean? If you add
margin-top: 2px
to the bottom div, it will appear 2px further down, i.e. not touching. Is there a problem with this...?