Display Property

The CSS display property controls how an element is laid out — for example as a block, inline, none (hidden), flex, or grid. It is one of the most important layout properties.

Web

block elements stack vertically and take full width; inline elements flow within text; inline-block mixes the two. display: none removes the element entirely from the page.

Setting display: flex or display: grid turns an element into a powerful layout container for its children.

Examples

CSS

span { display: block; }
.hidden { display: none; }
.row { display: flex; }

Output:

Makes spans stack like blocks, hides '.hidden' elements, and turns '.row' into a flex container.

Learn it in a lesson

See also

Back to the Dictionary