What box an element generates
The display property is the single most important layout switch in CSS: it
decides whether an element is a block or inline box and which layout model
(flow, flex, grid, table) governs its children. Modern CSS reframes
every value as an outer plus inner display type, which makes the once-mysterious
keywords much clearer. This reference lists the common values with their
outer/inner types and a resolver that expands each legacy keyword.
How it works
A legacy single keyword maps to an outer + inner pair:
display: block; /* = block flow */
display: inline-block; /* = inline flow-root */
display: flex; /* = block flex */
display: inline-grid; /* = inline grid */
The outer type (block or inline) sets how the box itself flows among its
siblings; the inner type sets the formatting context for its children.
flow-root is special: it establishes a new block formatting context, which is
why inline-block (inline flow-root) sizes like a block. The box-generation
values stand apart: list-item adds a ::marker, contents makes the box
itself disappear while keeping its children, and none removes the whole subtree
from layout and the accessibility tree.
Tips and notes
display: flex/gridonly changes the children’s layout, not the element’s outer flow.- Use
flow-root(orinline-block) to contain floats without an empty clearfix element. contentsis powerful for unwrapping, but audit accessibility — it drops the box from the a11y tree.none≠visibility: hidden:noneremoves space,hiddenkeeps it.