W3C home > Mailing lists > Public > www-style@w3.org > April 2012

[CSS21] Why do overflow values other than 'visible' establish a new block formatting context?

From: Daniel Tan/BoltClock <lists@NOVALISTIC.com>
Date: Mon, 02 Apr 2012 11:24:32 +0800
Message-ID: <4F791BF0.2040804@NOVALISTIC.com>
To: "www-style@w3.org" <www-style@w3.org>
In the following Stack Overflow question, we observe that applying 
overflow: hidden to a container element causes it to stretch to contain 
a floated image (assuming a default automatic height):


This is, of course, expected behavior. As stated in 
<http://www.w3.org/TR/CSS21/visuren.html#block-formatting>, applying an 
overflow value other than 'visible' to a box creates a new block 
formatting context for the box and its contents. For a container without 
a specific height (i.e. it's automatic), this causes it to stretch 
vertically until it can fully contain all of its descendants, floated or 

This leads us to wonder: why is this so? I am under the impression that 
removing floats from normal flow will interfere with clipping and 
scrolling, but am not sure how exactly. I can't seem to find any 
previous threads in the mailing list that discuss the overflow property 
in particular.

To that end, we have opened another question, which can be found in the 
following link. Since this does not appear to be covered in the 
formatting model spec, we would be grateful if we could obtain an 
authoritative view on it, as it would only invite pure speculation 


Quoting from the above question:

 > The CSS2.1 spec mandates that overflow other than visible establish a
 > new "block formatting context". This strikes me as odd, that a
 > property whose obvious purpose is to hide overflow without affecting
 > layout, actually does affect layout in a most major way.
 > It seems like overflow values other than visible combine two
 > completely unrelated features: whether a BFC is created and whether
 > the overflow is hidden. Its not like "overflow:hidden" is completely
 > meaningless without a BFC: because floats historically can overflow
 > their parent element, hiding the overflow without changing the layout
 > seems sensible.

Thanks in advance for any insights.

Daniel Tan/BoltClock
NOVALISTIC  Stellar Software Development & Design
Received on Monday, 2 April 2012 03:25:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:14 UTC