For some reason IE8 calculates an offset of 18px
on a CSS element.
When I add a top: -18px
and left: -8px
it fixes the issue in IE8 but breaks it in every other browser.
I tried adding hacks like the \9
and \0/
but those do not work in IE9.
Adding the \9
after the top
and left
attributes fix IE8.
However, IE9 does not seem to recognize the hack and uses the negative top
and left
values and the layout breaks.
I need a way to fix this but it needs to be something I can do in the CSS only.
This is just a small menu which is used all over the place in a much larger Java project and I do not have access to the rest of the code. Only to the CSS.
Here is the CSS class that is getting the offset:
#myMenuBar{
position: relative;
width:800px;
height:auto !important;
height:36px;
margin:0 auto;
z-index:3001;
text-align:left;
top: 0px;
left: 0px;
}
Like I said, changing the top and left to -18px and -8px respectively fixes the issue in ie8 but breaks it everywhere else since ie8 is the only browser which calculates this offset.