W3C home > Mailing lists > Public > www-style@w3.org > March 2008

Re: [CSS2.1] 9.5.1 Positioning the float: the 'float' property

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 28 Mar 2008 16:10:28 -0700
To: www-style@w3.org
Message-ID: <20080328231028.GA1420@ridley.dbaron.org>

On Friday 2008-03-28 14:41 -0700, Alan Gresley wrote:
> 9.5.1 Positioning the float: the 'float' property
> 
> http://www.w3.org/TR/CSS21/visuren.html#float-position
> 
> 
> In the listed rules under the heading "Here are the precise rules that
> govern the behavior of floats"
> 
> There is no mention of the right edge for a left floated element or
> left edge of a right floated element. Since this is no mention of this
> opposing margin in the spec we now have two behaviors among browsers
> when elements are floated right.
> 
> 1. This opposing left edge is ignored.
> 2. This opposing left edge is used.

Since it's not mentioned (as you say), it's clearly ignored, according
to the current spec.  This means that, according to the current spec
(and the test results you described), the use of the left edge when
positioning right floats in IE, Safari, and Opera 9.26 (but not 9.5) is
a bug.

That said, I can see the value in changing the definition to prevent
having overflow in a direction the user cannot reach by scrolling.
However, given how long the current rules have been in place, I think
it's too late to change this.  These rules have been quite clear since
CSS1 (see http://www.w3.org/TR/REC-CSS1-961217#floating-elements , and
note the December 1996 date).

> Please see this test case (this case also applies to the body element).
> 
> http://css-class.com/test/css/overflow/float-container-margin-overflow.htm
> 
> 
> Resize the browser window until the green element floated left is
> being hidden in the overflow container.

For what it's worth, this would have been easier to test with a testcase
that didn't require resizing the window (which would have been easy to
write).

> Gecko 1.7~1.8 and Opera 9.5: Will show the blue element floated right
> vanishing into the overflow containers' left edge. The padding-right
> of the overflow container is shown to the right of the green element
> floated right. Opera also shows a bug of showing a mysterious extra
> space to the right of the green element.

Opera's extra space to the right seems like a bug; I don't see any
reason for it.  (Is the size of the extra space correlated with the left
padding, right padding, or one of the borders?)

> Gecko 1.9: Shows exactly the same as Gecko 1.7 and 1.8 but the
> padding-right is clipped from the overflow container. This clipping I
> have spoken about in my list messages.

I think the Gecko 1.8 behavior (having space for the padding past the
overflow) is probably preferable for authors, although as far as I can
tell the spec requires the Gecko 1.9 behavior (since the padding box
lives inside the border box and its size is not influenced by the
overflow).  It might be worth considering changing the spec here, but
looking at this issue requires looking at testcases that don't trigger a
whole bunch of other differences in behavior.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Friday, 28 March 2008 23:11:04 GMT

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