These keywords specify the element's inner display type, which defines the type of formatting context that lays out its contents (assuming it is a non-replaced element). These keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the <display-outside> keywords.
Valid <display-inside> values:
flowThe element lays out its contents using flow layout (block-and-inline layout).
If its outer display type is inline, and it is participating in a block or inline formatting context, then it generates an inline box. Otherwise it generates a block container box.
Depending on the value of other properties (such as position, float, or overflow) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context (BFC) for its contents or integrates its contents into its parent formatting context.
flow-rootThe element generates a block element box that establishes a new block formatting context, defining where the formatting root lies.
tableThese elements behave like HTML <table> elements. It defines a block-level box.
flexThe element behaves like a block element and lays out its content according to the flexbox model.
gridThe element behaves like a block element and lays out its content according to the grid model.
rubyThe element behaves like an inline element and lays out its content according to the ruby formatting model. It behaves like the corresponding HTML <ruby> elements.
Note: Browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block. This will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box.
<display-inside> =
flow |
flow-root |
table |
flex |
grid |
ruby
In this example the parent box has been given display: flow-root and so establishes a new BFC and contains the floated item.
<div class="box"> <div class="float">I am a floated box!</div> <p>I am content inside the container.</p> </div>
.box {
background-color: rgb(224 206 247);
border: 5px solid rebeccapurple;
display: flow-root;
}
.float {
float: left;
width: 200px;
height: 150px;
background-color: white;
border: 1px solid black;
padding: 10px;
}
| Specification |
|---|
| CSS Display Module Level 3> # typedef-display-inside> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
display-inside |
58 | 79 | 53 | 45 | 13 | 58 | 53 | 43 | 13 | 7.0 | 58 | 13 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
display-inside |
1 | 12 | 1 | 7 | 1 | 18 | 4 | 14 | 1 | 1.0 | 4.4 | 1 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
display-inside |
2921 | 12 | 20Firefox 28 added multi-line flexbox support. |
161512.1–15 | 97 | 2925 | 20Firefox for Android 28 added multi-line flexbox support. |
161412.1–14 | 97 | 2.01.5 | 4.44.4 | 97 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
display-inside |
57 | 1612 | 52 | 44 | 10.1 | 57 | 52 | 43 | 10.3 | 6.0Samsung Internet added this earlier than the corresponding Chrome version would indicate. |
57 | 10.3 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
display-inside |
121 | 12–79 | 38 | 107 | No | 121 | 38 | 81 | No | 25.0 | 121 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/display-inside