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

Re: Floating objects

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Fri, 14 Jan 2000 11:33:09 +0100 (MET)
To: Allan Odgaard <Duff@DIKU.DK>
Cc: WWW-Style@w3.org
Message-ID: <14462.62483.162964.551156@www43.inria.fr>
Allan Odgaard writes:
> On 12-Jan-00, Bert Bos wrote:
[...]
> > Also take a look at the 'overflow' property of CSS2. That determines
> > whether the part that sticks out should be visible or not.
> 
> Speaking of which, is there any recommended placement of the scrollbar when
> this property is set to 'scroll'?  (i.e. inside or outside the padding, border
> or margin) -- and should the space it occupies be counted as content space?
> For example if I set the width of a box to 200px, and give it a scrollbar,
> should the 200 pixels then include the scrollbar? If yes then I think that
> it's a little problematic since the user has no idea of how wide the scrollbar
> is (and cannot calculate the proper width he should give to his box, assuming
> he e.g. has a box with an image of fixed size)  Also, the standard says:
> "[...] the user agent uses scrolling mechanism [...] such as a scroll bar
> [...] that mechanism should be displayed for a box *whether or not* any of its
> content is clipped."  Does that mean I should add both a vertical and
> horizontal scrollbar?  Or could I settle with a vertical, and let the
> horizontal be 'auto'. Afterall, only the appearance/disappearance of the
> vertical one will cause lines to be re-flowed. The horizontal bar shouldn't
> affect the layout.

The "recommended" way to create a scrolling box is to use whatever the
user prefers; and if you don't know that, then use the standard way
for the windowing system you're programming for.

But you are free to use anything else: a hand pointer like in old
MacPaint, a thumbwheel like on Irix, a panner as in the Athena resedit
program, a dog's ear in the corner as (again) pioneered by the Mac, a
"more" button or a "zoom" button, or any style of scrollbars that you
like...

Where you put those scrollbars is also up to your sense of what looks
good and what is user-friendly. You can put them in the box (and thus
reduce the space for the text), you can put them along the side of the 
window, or you can have them pop up outside the box, or anything you
like.

The idea behind the value 'scroll' is that flashing is diminished when
the user resizes the window; and that boxes with the same style also
look the same, independent of the size of their content. But if your
chosen scrolling style doesn't display scrollbars for overfull boxes
(e.g., if you use the hand pointer), the value 'scroll' doesn't force
you to display some (but it would force you to display a hand pointer,
to be consistent with other scrolling boxes).

> 
> Btw: In the earlier standard I read, the 'visible' setting for the overflow
> property said that the containing box should be expanded to hold all its
> children. Now it shouldn't, out of curiosity: is this to favor incremental
> rendering?

Correct.

[...]
> Now just one more question:
> 
> >From "9.5.1 Positioning the float: the 'float' property":
> 
>    5. The outer top of a floating box may not be higher than the outer 
>       top of any block or floated box generated by an element earlier 
>       in the source document. 
> 
> Just to be sure, this rule says *both* left & right floated boxes, generated
> earlier, should be considered, right?  I.e it would be incorrect to render
> this:
> 
>    Hello world
>    <Img Align=Right Width=70 ...>
>    <Img Align=Left Width=30 ...>
>    this is nice!
> 
> As:
> 
>    +-+ Hello world
>    |2| this +-----+
>    +-+ is   |  1  |
>    nice!    +-----+

Indeed. The rule refers to both left and right floating boxes. In your
drawing, the second float is higher than the first and that is not
allowed.

The correct rendering would be:

    Hello world
    +-+ this +-----+
    |2| is   |  1  |
    +-+      +-----+
    nice!

Box 1 doesn't fit after "world" so it has to go down to below that
line. Box 2 fits next to box 1. But then the word "nice!" doesn't fit
in between anymore and it will go down to the next line.



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 Friday, 14 January 2000 05:33:21 GMT

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