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

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

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Wed, 9 Aug 2000 21:13:22 +0200 (MEST)
To: www-style@w3.org
Message-ID: <14737.41040.969424.721621@lanalana.inria.fr>
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 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:13:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:54 UTC