View Full Version : Top margin IE7 error

02-13-2011, 09:57 PM
I am working on a site, and an absolute positioned element seems to behave weird only in IE7. There is a ribbon that is in the upper right hand corner that says "resource center" with a plus sign by it.

In all other browsers it is positioned lower, so it covers up most of the top header, which is the way it is supposed to be. How can I fix it so that it's vertical position isn't so high?


02-13-2011, 10:02 PM
Hello boogily,
Some versions of IE don't seem to do negative margins very well. Since that graphic's container is absolutely positioned, why not use top: -26px; in place of the negative margin?

02-14-2011, 03:46 AM
Switched to negative top, still does it

02-14-2011, 03:54 AM
IE is so odd about this kind of thing. Could be you need to specify height/width of that element? Height at least -
<div style="position: absolute; right: 20px; top: -26px; height: 60px;">

Why the inline styles? Also, it's just an anchor with an image so it hardly needs to be in it's own div. It doesn't make sense to be nested in paragraph tags either...

02-14-2011, 04:00 AM
One more thing, your unnamed inline styled <div style="width:1001px; margin:0 auto; position:relative;"> only encloses the graphic your trying to put negative position on?

That graphic should be position off a relative container of the whole site, or the #header... probably not some random div sitting at the top of the site doing nothing.

02-14-2011, 04:25 AM
Thanks. I so overthought this. I just made it relative to the header. Thats it. Thanks@!

02-14-2011, 05:01 AM
Thanks. I so overthought this. I just made it relative to the header. Thats it. Thanks@!

Right on, glad you got it going :)