Yet another ie6 weirdness

According to the W3C Specs a position:fixed box's position is calculated according to the position:absolute model, but in addition, the box is fixed with respect to [...] the viewport (and doesn't move when scrolled).

Using the following CSS-Code:

position: absolute;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -100px;

I can center a 200x200 px box on the screen. This works in nearly all browsers (tested: Firefox, Opera, ie:mac, ie6, ie7, Safari etc.). Using position:fixed instead of position:absolute the layout breaks in ie6. The box is not rendered in the center of the screen, but in the top-left-corner, and only the lower-right quarter is visible, due to the negative margins all other parts of the box are outside the viewport.

Edit: The weirdness continues ... While using absolute instead of fixed positioning solves the problem in ie6 (on windows) it breaks ie:mac 5.2 (on macintosh), which worked with position:fixed.

Veröffentlicht von Arne Brodowski am 20. Nov. 2006, 18:43 in , , , , , , .