Skip to main content

What does the display property do?

display determines how the element behaves in the document flow and what kind of box it forms. In simpler terms, this property sets the element's display type: block, inline, flexible, inline-block, and so on.

Examples of the main values:

ValueWhat it does
blockmakes the element block-level, takes the whole line, starts on a new line
inlinemakes the element inline, does not break the line, width matches the content
inline-blockinline, but with the ability to set width and height
flexturns the element into a flex container
gridturns the element into a grid container
nonefully hides the element and removes it from the flow

Summary: display is the property that controls the box type in the Box Model and determines how the element participates in the page layout.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

What does the display property do?: CSS Interview Question