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:
| Value | What it does |
|---|---|
block | makes the element block-level, takes the whole line, starts on a new line |
inline | makes the element inline, does not break the line, width matches the content |
inline-block | inline, but with the ability to set width and height |
flex | turns the element into a flex container |
grid | turns the element into a grid container |
none | fully 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 readyPremium
A concise answer to help you respond confidently on this topic during an interview.