<display-inside>
Quick Summary for <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.
Code Usage for <display-inside>
<div class="box">   <div class="float">I am a floated box!</div>   <p>I am content inside the container.</p> </div> 
More Details for <display-inside>

<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
CSS Display Module Level 3 # typedef-display-inside

Support of multiple keyword values

Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=804600

Support of flow-root

Support of table

Support of grid

Support of flex

Support of ruby

See also

display <display-outside> <display-listitem> <display-internal> <display-box> <display-legacy> Basic Concepts of Flexbox Basic Concepts of Grid Layout

Last modified: Feb 22, 2022, by MDN contributors

Select your preferred language English (US)Français日本語Português (do Brasil) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
When I realized that, no individual step is hard in any process. Building this airport I'm standing in right now started with a guy writing the architectural plans on paper. That's not hard for him to do. Then laying the first beam isn't had. The whole thing is really hard. So, just take each step kind of piece by piece and when I was able to do that and stop trying to chase this prize and started putting in the work, things just started coming together.
Unknown
Random CSS Property

min()

The min() CSS function lets you set the smallest (most negative) value from a list of comma-separated expressions as the value of a CSS property value. The min() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.
min() css reference