开发者

2 vertically positioned divs, what could prevent them from "touching?"

Click here to see what I mean.. What could prevent these two from sitting directly atop each other like that. At t开发者_StackOverflow社区he 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 :)


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


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


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...?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜