Re: margins on floated elements
Bert Bos wrote:
> We should probably make it explicit which overlaps which. In the
> absence of explicit z-ordering, the best strategy is probably that
> non-floating things overlap floating things and that things later in
> the logical (document) order overlap earlier things.
That makes sense inasmuch as the most common use of overlap will be
text over images or floated first letters. But "float overlaps parent
except that text is always on top" also makes sense and makes it clear
that the floated element overlaps the background of the parent element
-- which I believe most author/designers would find desirable.
> The effect of setting the width of a floating element (other than an
> image) to `auto' is currently not defined.
> If we decided to define it, what would be the most useful
> interpretation? When I implemented this myself, I arbitrarily used
> of the parent's width. But a more sophisticated sizing algortihm is
> possible as well, a la the table sizing. Requiring that would put
> burden on the implementations, but it may be worth it; it may give us
> something very close to run-in headings for free...
IMO, auto width of floated text should be the lesser of (the width of
the text) and (the width of the parent less any margins, borders and
padding on the float). If the lesser is the latter, the text should
break to multiple lines. This makes run-in headings easy if the heading
is one line. Left-float a first letter with appropriate font size and
margins and you've got a drop cap.
Is this really such a burden? Routines for computing the width of a
line of text are already there.
In the case of elements with a width wider than the parent (either auto
or explicit), the additional width should extend beyond the edge of the
parent in the direction away from the float.
A "float-lines" property -- where the edge of the floated text element
corresponds to the line-box on a line-by-line basis -- would allow for
multi-line run-in headings. The bounding shape for a float-lines text
element would look like the background as applied to block text
elements in IE 3.0 and 3.01.