The CSS display property controls how an element is displayed on a webpage. It determines whether an element appears as a block, inline, flex, grid, or is completely hidden.
display Values| Value | Description | Example Element |
|---|---|---|
block |
Starts on a new line and takes full width. | <div>, <p>, <h1> |
inline |
Stays in line with other elements, takes only necessary width. | <span>, <a>, <strong> |
inline-block |
Similar to inline, but allows setting width and height. |
<button>, <input> |
none |
Hides the element completely. | Any HTML element |
flex |
Arranges elements in a flexible row/column. | Used in layout design |
grid |
Aligns elements in a structured grid. | Used for complex layouts |
block vs. inlinedisplay: block;)<div>, <p>, <h1>, <section>