I have used position:absolute on a page to align an element, I have used a fixed width of 800px and centered the page via auto margins. The position is correct on firefox but in IE the element is still being positioned from the edge of the screeen rather than the new width of my html declaration, how can I force IE to play ???
Don’t set position:relative on the html element because safari will hide all other elements in the page that have position:relative defined (nasty bug).
Also note that IE6/7 in quirks mode and ie5 and 5.5 will not center the page using his method because they don’t understand auto margins. They also assume body is the root and therefore you cannot use text-align:center on html to force the centring as you usually would.
In my opinion there are just too many bugs when using a width on the body or html and I much prefer to use a page container instead and centre that and avoid all the bugs and little issues.
No but styling <body> is usually fine AFAICT except in IE5 which I don’t care about. Applying backgrounds etc. on the root element (avoiding position:relative) also works fine. No?
Well I suppose you are right if you take ie5 and 5.5. (and ie6 and ie7 in quirks mode) out of the equation then most of the problems I mention aren’t applicable :).
There are still some issue with background images sliding off the screen but most of these can be fixed with position relative on the body as mentioned above. There was another bug I found but I can’t remember what it was so it can’t be that important.
I do still support ie5.5 which is why I avoid using the width on the body but as you say in modern browsers most of the bugs aren’t applicable