W3C home > Mailing lists > Public > www-style@w3.org > July 2009

question on width calculation for floats and tables nested inside a div

From: Dirk Pranke <dpranke@google.com>
Date: Thu, 02 Jul 2009 06:28:23 +0000
Message-ID: <3726d1bf0907011641g48941bebgf3da33d3c48188fe@mail.gmail.com>
To: www-style@w3.org
Cc: ian@hixie.ch
Hi all,

In the course of investigating a bug in WebKit, I've run across some
ambiguity on how to render tables sized at width:100% inside a div
that also has a float in it.

That sentence is a bit hard to parse, so this is best illustrated by
looking at the example:
https://bugs.webkit.org/attachment.cgi?id=32157

The relevant part of the CSS spec is section 9.5, paragraph 3:

"The border box of a table, a block-level replaced element, or an
element in the normal flow that establishes a new block formatting
context (such as an element with 'overflow' other than 'visible') must
not overlap any floats in the same block formatting context as the
element itself. If necessary, implementations should clear the said
element by placing it below any preceding floats, but may place it
adjacent to such floats if there is sufficient space. They may even
make the border box of said element narrower than defined by section
10.3.3. CSS2 does not define when a UA may put said element next to
the float or by how much said element may become narrower."

but how are we defining "sufficient space" The block formatting
context or the current containing block?

In my interpretation, option #1 is probably what everyone should be
doing (but no one does). Anyone want to give reasons as to why options
#2 or #3 make more sense?

Thanks,

-- Dirk
Received on Thursday, 2 July 2009 16:18:26 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT