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

Re: What should happen with auto margins?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 28 Feb 2003 13:17:54 -0600
Message-ID: <3E5FB5E2.7080401@mit.edu>
To: Tom Gilder <tom@tom.me.uk>
CC: www-style@w3.org

Tom Gilder wrote:
> If I have an element set to a width wider than the viewport and
> margin-left/right set to auto, how should the element display?

Unfortunately, the CSS specification has some wiggle-room here that 
makes all of the renderings involved "valid".  See 
http://www.w3.org/TR/CSS21/visudet.html#min-max-widths -- the part you 
want is the paragraph right after the numbered list that starts "The 
user agent may define a non-negative minimum value for the 'min-width' 
property, which may vary from element to element and even depend on 
other properties."  (Translation: "As long as the actual width is at 
least the specified width, the rendering is compliant no matter what").

So if in this case IE and Opera make up a min-width for the containing 
block of your element they can indeed satisfy the width constraint 
equation with 0 margins and be technically compliant.  Mozilla basically 
ignores that paragraph and treats min-width as 0 if min-width is not 
specified.  So that rendering is also compliant.

Try putting a border on the containing block of your element to see 
whether IE and Opera are indeed just increasing the CB width; I bet they 
are.  (Note that IE will even do this if you set a specified width on 
the CB and will be completely compliant as it does it.)
Received on Friday, 28 February 2003 14:18:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:06 UTC