The display property

The display property is perhaps one of the most fundamental properties in CSS.

A good way to think about it is to imagine treating each HTML element as a box. The display property determines how these boxes will be displayed.

Many values can be used with this property. However, only some of them are commonly used. We’ll focus on the following values:

  • inline
  • inline-block
  • block
  • flexbox
  • grid
  • none
  • table

The inline value

The inline value is the default value for every element in CSS. An inline element stays on the same line and only takes the necessary amount of width.

display: inline;

A neat way to visualize the inline value is to think of a paragraph containing some words wrapped in bold (<b>) or <span> tags:

Get hands-on with 1200+ tech skills courses.