|
Posted by rf on 12/20/10 11:30
sagejoshua wrote:
> I'm pretty sure that negative margins are far more cross-browser
> compatible (and suprisingly bugless) than auto margins. Netscape 4.x
> even renders negative margins correctly.
Using negative margins for centring is a Very Bad Mistake. If the viewport
is less than the width of the centred content then the content disappears
off the left hand of the viewport, never to be seen again. This content is
not accessible *at all*, the horizontal scroll bar will not let you to go
there.
Try it for yourself here:
http://www.snakebirdstudios.com/
Narrow the window to 640 pixels wide (not an uncommon size). Part of your
*navigation*, of all things, disappears.
To centre content use auto margins. For those browsers that do not support
it correctly (IE 5.x and IE6 in quirks mode) then use a suitable hack
(text-align: center;, hidden from other browsers, is one)
--
Cheers
Richard.
[Back to original message]
|