Re: Float overflowing behavior!

[Sun, 18 Aug 2002 11:43:33 +0000 (GMT)] Ian Hickson:
>On Sat, 17 Aug 2002, C. Bottelier wrote:
>>
>> To summarize an element can be made float inorder to achieve the
>> 6 cases seen in this thread.
>
>For the benefits of the working group, could you summarise these 6 cases
>as well?

The six cases given in this thread were:

1. Box floats to the left content edge of the containing block; subsequent
text flows around it.

2. Box floats to the left content edge of the containing block; text from
the containing block flows around it, but the containing block is extended
at the bottom, if necessary, to encompass the float.

3. Box floats to the left content edge of the containing block; some
subsequent text flows around it, but either a subsequent block or an
ancestor of the containing block is extended at the bottom, if necessary,
so that the float does not run past it.

4. Box floats to the left content edge of a specified ancestor of the
containing block.

5. Box floats to the left content edge of the containing block and second
box floats to the right edge of the first.  The containing block is
extended at the bottom to encompass the first float, but not the second.

6. Text flows around the irregular edge of inclusions and/or line boxes in
the float (rather than around the float box itself).


>At least one of the six cases can be done using CSS1 (see
>http://lists.w3.org/Archives/Public/www-style/2002Aug/0137.html) so it's
>not completely clear that all the proposed properties are needed.

Case 1 is the only one of these handled *naturally* by CSS2.

Cases 2 and 3 can be accomplished in CSS2 by adding a "dummy" element at
the end of the block to be extended and setting the "clear" property on it.

Case 4 can be accomplished in CSS2 by using a negative value for the
margin-left property so long as the required value can be computed
when the style sheet is written.  (E.g., suppose the block containing the
box to be floated has "font-size: small"; the block containing it has
"font-size: large"; both blocks have non-zero padding-left which is
expressed in em spaces; and the box is to be floated to the content edge of
the parent of the latter block.  As far as I can see, there would be no way
to specify the necessary margin-left value, as it would be the sum of
em-space measures from two different entries in the font size tables.)

Cases 5 and 6 probably cannot be accomplished at all using CSS2.


>While some of the suggested properties look very interesting, we are of
>course very wary of adding 3 new properties without looking very carefully
>at the requirements. Also, changing 'float', a property that was
>introduced in CSS1 and still has no completely correct implementation, is
>something that would have to be considered very carefully indeed.


The "float-contour" property was specifically suggested for case 6;
it does nothing to help in the other cases, and appears unrelated to the
other proposed changes.  I believe it can be considered independently.


The "float-overflow" property as proposed by the original poster in this
thread was meant to handle cases 2 and 3 in a more natural way.  It would
do nothing to help in cases 4, 5 and 6.

It was noted that "float-overflow" could be defined to apply to floats
themselves (instead of to blocks to be extended by floats, as in the
original proposal).  This would handle cases 2 and 5 in a straightforward
fashion; it would do nothing to help in cases 3, 4 and 6.


I suggested some extensions to the "float" property syntax and the addition
of the "float-bounds" property as an alternative to "float-overflow."

The additional values I suggested for the float property were intended to
open discussion as to the underlying logic of floats, and possible ways
floats could be used.  They do not directly address any of the problem
cases yet discussed in this thread, but rather (with the "float-bounds"
property) were meant to suggest a fuller model of "what a float is."

The "float-bounds" property directly addresses cases 1-5 --- though case 3
can be handled only when the block to be extended is an ancestor of the
float, not a subsequent block.  (In practical cases, I do not expect this
to be a problem; however, it is a limitation which is not shared by the
original "float-overflow" proposal.)  "Float-bounds" won't help in case 6.

"Float-bounds" can be thought of as (in part) a way to combine the original
and variant versions of "float-overflow," taking the best points of each:

* Extended element doesn't have to be the float's parent.  (original)
* Different floats in same context can be handled differently.  (variant)
* Applies to the floats, where one would expect to find it.  (variant)

as well as adding the ability to float to an edge of an ancestor element
other than the immediate parent without having to calculate a negative
margin property to achieve the effect.
-- 
Randall Joseph Fellmy aka Randy@Coises.com

Received on Sunday, 18 August 2002 18:35:12 UTC