RE: Auto width for floating elements (Re: Displaying a structure in CSS)

Internet Explorer has done this since IE 5.0 (Windows).

-Chris Wilson

-----Original Message-----
From: Bert Bos [mailto:Bert.Bos@sophia.inria.fr]
Sent: Wednesday, August 09, 2000 12:13 PM
To: www-style@w3.org
Subject: Auto width for floating elements (Re: Displaying a structure in
CSS)


ValerieGSharp writes:
> Matthew Brealey wrote:
[...]
> > But that this is so is completely the result of chance. In particular,
> > you have floated an element without observing the spec requirement that
> > such elements have an explicitly set width (although I firmly believe
> > (see my proposal
> > (http://richinstyle.com/proposals/floatproposal.html#width)) it should
> > be removed).

It is indeed attractive to allow 'width: auto' on floating elements to
automatically find a "reasonable" width, similar to the way tables get
their width. But it is also a performance hit and an extra complexity
for the programmers.

When I asked some programmers a few years back, they said: "Please,
not another table layout algorithm!" However, it seems that opinions
have changed.

I have the impression (please correct me if I'm wrong) that
programmers are now willing to implement auto-sizing for floats, and
leave it to page authors to decide whether they want the performance
penalty or not.

The suggested algorithm could be relatively straightforward (at least
to describe, not necessarily to implement): lay the contents out to
the full width of the containing block, just like for a block element,
except when the box can be made narrower without introducing extra
line breaks or more overflow.

This would be the same algorithm as for the proposed 'display:
inline-block', so it seems we'll need the code anyway.



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, 9 August 2000 15:42:23 UTC