W3C home > Mailing lists > Public > www-style@w3.org > January 2000

Re: Floating objects

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Tue, 11 Jan 2000 20:25:11 +0100 (MET)
To: Allan Odgaard <Duff@DIKU.DK>
Cc: www-style@w3.org
Message-ID: <14459.30047.466120.150612@www43.inria.fr>
Allan Odgaard writes:

> OK, one more question: Had the floating object been the tallest, would the
> following element than have been closed without first 'flushing' any floats?
> E.g.
> 
>     ###################
>     #+--------+ Small #
>     #|Big box | box!  #
>     #|of much |########
>      |text    |
>      |floating|
>      |here... |
>      +--------+

Yes, this is correct.

> 
> If this is the case then which exceptions exist? I.e. I assume that table-cells
> should flush any floating objects, before the box is closed. And the same
> should probably also apply to other floating objects, and maybe absolute
> placed objects?

I don't think it has been specified explicitly anywhere, but
implementations indeed seem to treat tables that way. Seems reasonable
to me. Tables are already complicated enough. Same for a float inside
a float.

I don't think the same holds for absolute positioning. What exactly
would you "flush"?

> 
> 
> Another thing I've been considering is whether this markup:
>    <P>Hello <Div Style="float: left">Floating text...</Div>World!</P>
> Should be rendered as:
> 
>    Hello world!
>    +--------+
>    |Floating|
>    |text... |
>    +--------+
> 
> Or instead:
> 
>    Hello 
>    +--------+world!
>    |Floating|
>    |text... |
>    +--------+

Neither, in fact. It should be like this:

    +--------+Hello
    |Floating|world!
    |text... |
    +--------+

since the float fits without moving it down to the next line.

Many browsers still don't do this, probably because they
reverse-engineered Netscape when it first introduced floating images,
before CSS became a standard.

Oh, and btw: the mark-up is invalid :-) You cannot put a DIV inside a
P. But if you change it to a SPAN the example will work again.

> 
> I suspect it's the first way, but this gives a problem (in the implementation)
> if the text after the float changes the line-height.  I.e. when I see the
> floating object I'll place it below the current linebox of the containing
> object. But if more text is added to this linebox, it may grow in height, and 
> the position given to the floating object is wrong (it should be pushed down
> the same amount of space as the linebox gained)

Yes, I know the problem. Somehow you'll have to postpone the placement 
of the float.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Tuesday, 11 January 2000 14:25:16 GMT

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