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

Bert Bos wrote:
> 
> 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.


Given that proposed changes to CSS2 are expected concerning the
calculation of widths of Absolutely Positioned elements, i.e. that an
'auto' width will be based on the content of the element, presumably any
such algorithm could similarly be applied to floats?


-- 
Regards,
Val Sharp - Edinburgh

Received on Sunday, 25 February 2001 11:51:14 UTC