Description
CSS 2.1 says
A block container box either contains only block-level boxes or establishes an inline formatting context and thus contains only inline-level boxes. [...]
Floats, absolutely positioned elements, block containers [...] that are not block boxes, and block boxes with 'overflow' other than 'visible' [...] establish new block formatting contexts for their contents.
It's not clear what should happen when a block container contains only inline-level boxes and establishes a BFC because of e.g. overflow: hidden
. From the quotes it seems like it simultaneously establishes both an inline formatting context and a block formatting context, but this would be weird. I think what should happen is that the block container establishes a BFC, and the inline-level contents are wrapped inside an anonymous block box that establishes an inline formatting context. That is, behave like if the block container contained some block-level box.
In CSS Display this is still not clear, the glossary says
A block container that contains only inline-level content establishes a new inline formatting context. [...]
A block container that contains only block-level boxes establishes a new block formatting context if its parent formatting context is not a block formatting context; otherwise, when participating in a block formatting context itself, it either establishes a new block formatting context for its contents or continues the one in which it participates
This would imply that a block container which contains only inline-level content never establishes a block formatting context. This would be bad.