Favorites

CSS <display-inside> Data Type

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

The <display-inside> data type is the inner display type, which sets how an element lays out its children: flow, flow-root, table, flex, grid or ruby.

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-inside> CSS data type represents the keywords that set an element's inner display type: the layout model the element uses for its own children. It is one half of the two-value syntax of the display property, together with <display-outside>, which sets how the element itself sits in its parent.

flow lays children out in normal flow, as blocks and lines of text. flow-root does the same but also creates a new block formatting context, which contains floats and prevents margins collapsing through the element. flex and grid turn the element into a flex or grid container. table makes it behave like an HTML table, ruby like a ruby annotation, and math lays out MathML content.

If only an inner keyword is given, the outer type defaults to block, except for ruby, which defaults to inline. So display: flex is the same as display: block flex, and display: inline grid is the same as the older inline-grid.

Examples:

.nav     { display: flex; }          /* block flex */
.gallery { display: grid; }          /* block grid */
.chip    { display: inline flex; }   /* inline-flex */
.clearfix { display: flow-root; }    /* contains floats */

Interactive Demo

A B C

Text after the box.

Demo Code
HTML Code
<div class="demo-element">
	<div class="demo-float"></div>
	<span>A</span>
	<span>B</span>
	<span>C</span>
</div>
<p class="demo-after">Text after the box.</p>
CSS Code
.demo-element span {
	padding: 4px 8px;
	background: #4361ee;
	color: #fff;
	font-size: 14px;
}
.demo-float {
	float: left;
	width: 70px;
	height: 70px;
	margin-right: 6px;
	background: #f72585;
}
.demo-element {
	width: 290px;
	gap: 6px;
	grid-template-columns: repeat(2, 1fr);
	padding: 6px;
	background: #e7ecff;
	outline: 2px solid #4361ee;
	display: block flow;
}

Syntax

<display-inside> = flow | flow-root | table | flex | grid | ruby | math

Values

  • flowLays out children using normal flow: block and inline layout.
  • flow-rootNormal flow inside a new block formatting context, which contains floats and stops margin collapsing.
  • tableThe element behaves like an HTML table element.
  • flexThe element is a flex container and lays out its children with flexbox.
  • gridThe element is a grid container and lays out its children with CSS grid.
  • rubyThe element behaves like an HTML ruby element, for annotating text.
  • mathThe element lays out MathML content (used for the math element).

Example

<div class="wrap">
<h1>CSS &lt;display-inside&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="demo flow"><span class="item">A</span><span class="item">B</span><span class="item">C</span></div>
<div class="label">display: flow (block)</div>
</div>
<div class="card">
<div class="demo flex"><span class="item">A</span><span class="item">B</span><span class="item">C</span></div>
<div class="label">display: flex</div>
</div>
<div class="card">
<div class="demo grid2"><span class="item">A</span><span class="item">B</span><span class="item">C</span></div>
<div class="label">display: grid</div>
</div>
<div class="card">
<div class="demo root"><span class="float"></span>Text beside a float, contained by flow-root.</div>
<div class="label">display: flow-root</div>
</div>
</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 */
.demo {
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed #94a3b8;
  background: #fff;
}

.item {
  padding: 8px 10px;
  margin: 4px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.flow .item { display: inline-block; }
.flex { display: flex; justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(3, 1fr); }
.root { display: flow-root; }
.root .float { float: left; width: 60px; height: 60px; margin: 4px; border-radius: 6px; background: #f59e0b; }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS display-inside 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.