W3C home > Mailing lists > Public > www-style@w3.org > February 2003

Re: What should happen with auto margins?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 28 Feb 2003 16:07:54 -0800 (PST)
To: Tom Gilder <tom@tom.me.uk>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <Pine.LNX.4.50.0302281604420.26931-100000@dhalsim.dreamhost.com>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:20 GMT