Where in the CSS spec does it define this behavior?
As stated in these two articles...
Smashing Magazine
When you flo
This behavior is defined in the point 3 of this CSS2.1 section:
9.7 Relationships between display, position, and float
The three properties that affect box generation and layout — display, position, and float — interact as follows:
- If display has the value
none, then position and float do not apply. In this case, the element generates no box.- Otherwise, if position has the value
absoluteorfixed, the box is absolutely positioned, the computed value of float isnone, and display is set according to the table below. The position of the box will be determined by the top, right, bottom and left properties and the box's containing block.- Otherwise, if
floathas a value other thannone, the box is floated anddisplayis set according to the table below.- Otherwise, if the element is the root element,
displayis set according to the table below, except that it is undefined in CSS 2.1 whether a specified value oflist-itembecomes a computed value ofblockorlist-item.- Otherwise, the remaining display property values apply as specified.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ #Specified value# ┃ #Computed value# ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ inline-table │ table │ ├──────────────────────────────────────────────────────────┼──────────────────┤ │ inline, table-row-group, table-column, table-column-group│ block │ │ table-header-group, table-footer-group, table-row │ │ │ table-cell, table-caption, inline-block │ │ ├──────────────────────────────────────────────────────────┼──────────────────┤ │ others │ same as specified│ └──────────────────────────────────────────────────────────┴──────────────────┘
In Display Level 3, this process is called blockification:
2.7. Automatic Box Type Transformations
Some layout effects require blockification or inlinification of the box type, which sets the box’s outer display type, if it is not none or contents, to block or inline (respectively).
Some examples of this include:
- Absolute positioning or floating an element blockifies the box’s display type. [CSS2]