<display-inside>

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.

Syntax

Valid <display-inside> values:

flow
The element lays out its contents using flow layout (block-and-inline layout).

If its outer display type is inline or run-in, 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-root
The element generates a block element box that establishes a new block formatting context, defining where the formatting root lies.
table
These elements behave like HTML <table> elements. It defines a block-level box.
flex
The element behaves like a block element and lays out its content according to the flexbox model.
grid
The element behaves like a block element and lays out its content according to the grid model.
ruby
The 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.

Examples

In this example the parent box has been given display: flow-root and so establishes a new BFC and contains the floated item.

HTML

<div class="box">
  <div class="float">I am a floated box!</div>
  <p>I am content inside the container.</p>
</div>

CSS

.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;
}

Result

Specifications

Specification Status
CSS Display Module Level 3
The definition of 'display-inside' in that specification.
Candidate Recommendation

Browser compatibility

Support of multiple keyword values

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Multi-keyword values
Experimental
Chrome No support NoEdge No support NoFirefox Full support 70IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

Support of flow-root

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
flow-rootChrome Full support 58Edge Full support 79Firefox Full support 53IE No support NoOpera Full support 45Safari Full support 13WebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 53Opera Android Full support 43Safari iOS Full support 13Samsung Internet Android Full support 7.0

Legend

Full support
Full support
No support
No support

Support of table

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
table, table-cell, table-column, table-column-group, table-footer-group, table-header-group, table-row, and table-row-groupChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 8Opera Full support 7Safari Full support 1WebView Android Full support ≀37Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 14Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support
Full support

Support of grid

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
gridChrome Full support 57Edge Full support 16
Full support 16
Full support 12
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Firefox Full support 52IE Partial support 10
Prefixed Notes
Partial support 10
Prefixed Notes
Prefixed Implemented with the vendor prefix: -ms-
Notes Internet Explorer implements an older version of the specification.
Opera Full support 44Safari Full support 10.1WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 52Opera Android Full support 43Safari iOS Full support 10.3Samsung Internet Android Full support 6.0
Notes
Full support 6.0
Notes
Notes Samsung Internet added this earlier than the corresponding Chrome version would indicate.

Legend

Full support
Full support
Partial support
Partial support
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

Support of flex

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
flexChrome Full support 29
Full support 29
Full support 21
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Edge Full support 12Firefox Full support 20
Notes
Full support 20
Notes
Notes Firefox 28 added multi-line flexbox support.
No support 18 — 28
Disabled
Disabled From version 18 until version 28 (exclusive): this feature is behind the layout.css.flexbox.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Partial support 11
Notes
Partial support 11
Notes
Notes IE incorrectly positions inline block content inside flex containers. See the discussion on Microsoft Answers.
Partial support 8
Notes Alternate Name
Notes IE incorrectly positions inline block content inside flex containers. See the discussion on Microsoft Answers.
Alternate Name Uses the non-standard name: -ms-flexbox
Opera Full support 16
Full support 16
Full support 15
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
No support 12.1 — 15
Safari Full support 9
Full support 9
Full support 6.1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
WebView Android Full support 4.4
Full support 4.4
Full support ≀37
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Chrome Android Full support 29
Full support 29
Full support 25
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox Android Full support 20
Notes
Full support 20
Notes
Notes Firefox 28 added multi-line flexbox support.
No support 18 — 28
Disabled
Disabled From version 18 until version 28 (exclusive): this feature is behind the layout.css.flexbox.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 16
Full support 16
Full support 14
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
No support 12.1 — 14
Safari iOS Full support 9
Full support 9
Full support 7
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Samsung Internet Android Full support 2.0
Full support 2.0
Full support 1.5
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-

Legend

Full support
Full support
Partial support
Partial support
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

Support of ruby

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
ruby, ruby-base, ruby-base-container, ruby-text, and ruby-text-containerChrome No support NoEdge No support 12 — 79Firefox Full support 38
Full support 38
No support 34 — 38
Disabled
Disabled From version 34 until version 38 (exclusive): this feature is behind the layout.css.ruby.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Full support 7Opera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 38
Full support 38
No support 34 — 38
Disabled
Disabled From version 34 until version 38 (exclusive): this feature is behind the layout.css.ruby.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support
Full support
No support
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

See also