CSS: Display Property

By Xah Lee. Date: . Last updated: .

CSS display property lets you control layout.

It is one of the most powerful property for layout, but is complex to understand.

Here's the basics.

There are 2 major types of “rendering box” for a HTML element:

Simple Example

Here's a example of changing list items as inline.

Here's a list, without style:


Here's the same list, but each li set to display:inline:

<li style="display:inline">one</li>
<li style="display:inline">two</li>
<li style="display:inline">three</li>

What's Rendering Box Type?

The details are fairly complex, but basically it's like this.

Each element, has a “rendering box type”.

The “rendering box type” determines 2 things:

  1. How it is positioned with respect to its neighbor elements. e.g. block level (like a paragraph p), inline (like a bold b word in a sentence.), table (like block but width does not span the window width, it's shrink wrapped to the table's content's width, which is automatically computed by default.), and others.
  2. How it is children elements behave. e.g. table, ul (list), their child elements all have special type of rendering box.

Display Property Values

Here's complete list of values for display.

⭐ means it's not widely supported by browsers yet.


These controls their layout with respect to neighbor elements.



These controls the layout of their child elements.

display-outside and display-inside




Universal CSS Property Values

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.