display

Specifies the display behavior of an elements rendering box.

Syntax

display: <value>;

The following values can be appplied to the display property:

  • inline
  • block
  • contents
  • flex
  • grid
  • inline-block
  • inline-flex
  • inline-grid
  • list-item
  • run-in
  • table
  • table-caption
  • table-column-group
  • table-header-group
  • table-footer-group
  • table-row-group
  • table-cell
  • table-column
  • table-row
  • none
  • initial
  • inherit

Example 1

Setting a div element to behave like a flex box.

<div class="flexdiv">
<p>First item</p>
<p>Second item</p>
</div>
.flexdiv {
display: flex;
}

display

clear
Specifies whether an element coming after a floated element should be moved down or not.
float
Places an element on the left or right side of its container.

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn CSS on Codecademy

Contributors