Re: What should happen with auto margins?

On Sat, 1 Mar 2003, Tom Gilder wrote:
>
> On Friday, February 28, 2003, 7:44:16 PM, Ian Hickson wrote:
> > No, in the case of Opera7 and IE6, the right margin becomes negative while
> > the left margin is zero, while in Mozilla's case the two margins are both
> > equal to the same negative value.
>
> Thanks to all who replied.
>
> So (going a tiny bit OT here) within the CSS specification, is there any
> way of emulating Op7/IE6's behavior, presuming that the browser doesn't
> support left-scrolling (as Mozilla does not)?
>
> It's slightly irritating that I can't find a way to center an entire
> page, without it going off the page in at least one browser (other than
> using max-width hacks) - really is a quite ridiculous state of affairs :/

   width: 20em; /* your preferred width */
   max-width: 100%; /* prevent the width from exceeding the viewport */
   margin: auto; /* center it horizontally */

...should do the trick, and is not a hack, it's exactly the intended use
of the properties.

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 28 February 2003 19:07:53 UTC