Re: Floating objects

Allan Odgaard writes:
> On 11-Jan-00, Bert Bos wrote:
> 
> >> If this is the case then which exceptions exist? I.e. I assume that
> >> table-cells should flush any floating [...] absolute placed objects?
> > [...] I don't think the same holds for absolute positioning. What
> > exactly would you "flush"?
> 
> If an absolutely placed box has a border and contains a floating box which
> would normally overflow the container then I would like to enlarge it, so that
> the border of the container would be drawn below the floating box, rather then
> through it.  The same should be the case for a box with "position: fixed".

Ah, I didn't understand the question. Yes, I think that is reasonable
to do.

> 
> >> 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: [...]
> > Neither, in fact. It should be like this:
> 
> Thanks! It turns out that I was reading an older draft of the CSS2-standard,
> which explains my lack of knowledge toward the layout of floating objects, as
> that draft wasn't really complete ;-)
> 
> Though I still have a few more questions:
> 
> The standard says:
> 
>    "Since an inline box may not exceed the width of a line box,
>     long inline boxes are split into several boxes [...]"
> 
> It's natural to split an inline box if it contains a space. But if the inline
> box is without any spaces, am I then allowed to split the box where I see fit?
> E.g. if the inline box contains a word which is wider than the container,
> should the inline box then bleed outside its container? Or should the word be
> splitted?

We will probably have one or more properties for hyphenation and
line-breaking in CSS3 that specify whether you are allowed to break
such a long word or not, but for the moment it is not specified.

Unless you can do true hyphenation, I think it is better not to split
such a long word.

Also take a look at the 'overflow' property of CSS2. That determines
whether the part that sticks out should be visible or not.

Amaya can hyphenate, but some other browsers that don't hyphenate
still split words at dashes. This is also unspecified in CSS2, so its
up to you whether you want to do that.

> 
> 
> About the 'width' property then it's said that for "Block-level, replaced
> elements in normal flow": "If 'width' is specified as 'auto', its value is the
> element's intrinsic width."
> 
> What if a block-level box contains both replaced and non-replaced contents,
> e.g.
> 
>    <Div Style="width: 200px">
>       <Div Style="text-align: right">
>          Hello world!
>          <Img Width=400 Src=...>
>          Hello again!
>       </Div>
>    </Div>
> 
> What is then the width of the inner 'div' element? If it is 400 pixels, will
> the text then be right-aligned as if so? (which sort of makes incremental
> rendering impossible) Or will the two paragraphs be right-aligned as if the
> width was only 200 pixels, and the image will simply bleed outside the inner
> 'div'?

The two DIVs are not replaced elements. As normal block elements, they 
get their width from their parent or from their own 'width' property.

In this case, the outer DIV will be 200px, since that is specified
explicitly. The inner DIV will then *also* be 200px, since there are no
margins, padding, border, or width set on it that would change that.

The IMG is by default inline, and since I see no 'display' property
anywhere, I assume that is what it is here as well. The IMG will
therefore be one of those "long words" that you talked about earlier:
it will stick out into the margin. In this case, since the lines are
right-aligned, it will stick out into the left margin.



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 Wednesday, 12 January 2000 15:13:25 UTC