CSS <display-legacy> Data Type
The <display-legacy> data type is a single-keyword display value: inline-block, inline-table, inline-flex or inline-grid.
Description
The <display-legacy> CSS data type represents the single-keyword display values that combine an inline outer type with a particular inner type: inline-block, inline-table, inline-flex and inline-grid. They come from earlier CSS levels, before display was split into separate outer and inner types, and they remain fully supported and widely used.
Each legacy keyword has an exact two-value equivalent. inline-block is inline flow-root: the element sits in a line of text but has a width, height, padding and margins like a block. inline-table is inline table, inline-flex is inline flex, and inline-grid is inline grid. The two forms behave identically, so you can use whichever you find clearer; the legacy forms have the widest browser support.
A common use of inline-block is for buttons, badges and other small components that should flow with text but still accept vertical padding and a fixed size. inline-flex is popular for icon-and-label buttons.
Examples:
.badge {
display: inline-block; /* = inline flow-root */
padding: 2px 8px;
}
.button {
display: inline-flex; /* = inline flex */
align-items: center;
gap: 6px;
}
.mini-grid {
display: inline-grid; /* = inline grid */
grid-template-columns: repeat(2, 20px);
}
Interactive Demo
Text before one two and text after it, which wraps onto the next line.
Syntax
<display-legacy> = inline-block | inline-table | inline-flex | inline-grid
Values
- inline-blockAn inline-level box that lays out its contents in normal flow with its own block formatting context. Equivalent to inline flow-root.
- inline-tableAn inline-level table. Equivalent to inline table.
- inline-flexAn inline-level flex container. Equivalent to inline flex.
- inline-gridAn inline-level grid container. Equivalent to inline grid.
Example
Browser Support
The following information will show you the current browser support for the CSS display-legacy data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





