tags:

views:

54

answers:

5

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 :)

A: 

Using a positive margin value should result in them being spaced further apart

Chris
A: 

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

David Hedlund
A: 

I'm not sure to understand your question correctly? Why don't you put a positive margin-top at your second div ?

pvledoux
+3  A: 

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

nemetroid
+1 firebug usage.
runrunraygun
Yeah, using firebug, have applid margin 0 to both elements, nothing in firebug and nothing else I can see that's inherited. Maybe it's internal browser styles. But I doubt that.
Kyle Sevenoaks
Well it was that the height had been set to 3em and was oversized. I was looking for the wrong attribute, accepting this answer as found the problem with Firebug. Thanks :)
Kyle Sevenoaks
+1  A: 

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.

chiborg