Favorites

CSS <display-legacy> Data Type

<display-legacy>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <display-legacy> data type is a single-keyword display value: inline-block, inline-table, inline-flex or inline-grid.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

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.

Demo Code
HTML Code
<p class="demo-text">Text before <span class="demo-element"><b>one</b> <b>two</b></span> and text after it, which wraps onto the next line.</p>
CSS Code
.demo-text {
	width: 290px;
	margin: 0;
	line-height: 1.8;
	color: #1b1f3b;
}
.demo-element b {
	padding: 0 6px;
	background: #f72585;
	color: #fff;
}
.demo-element {
	width: 120px;
	gap: 4px;
	padding: 4px;
	background: #ffe5f1;
	border: 2px solid #f72585;
	vertical-align: middle;
	display: inline;
}

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

<div class="wrap">
<h1>CSS &lt;display-legacy&gt; examples</h1>
<div class="card">
<p>Text with an <span class="ib">inline-block</span> box that has a fixed width.</p>
<p>Text with an <span class="ifl">inline-flex</span> pill containing a dot and a label.</p>
<p>Text with an <span class="ig"><span></span><span></span><span></span><span></span></span> inline-grid icon.</p>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
p {
  line-height: 2.2;
  margin: 0;
}

.ib {
  display: inline-block;
  width: 120px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  text-align: center;
}

.ifl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
}

.ifl::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.ig {
  display: inline-grid;
  grid-template-columns: repeat(2, 12px);
  gap: 3px;
  vertical-align: middle;
}

.ig span {
  height: 12px;
  border-radius: 2px;
  background: #7c3aed;
}
Open in editor

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.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.