display: none
The CSS declaration that removes an element and all its descendants from the render tree, so it takes no space and is not drawn.
In more detail
Unlike visibility: hidden, display: none frees the space for other elements and hides the content from screen readers too. Toggling it causes layout to run again.
Related terms
- visibility: hidden — The CSS declaration that makes an element invisible while keeping it in the layout, so it still takes up its space.
- render tree — The tree of visible elements with their computed styles, built from the DOM and CSSOM, that the browser uses for layout and painting.
- display — The CSS property that sets how an element takes part in layout, such as block, inline, flex, grid or none.
Taught in
- CSS Parsing, The CSSOM And The Render Tree — Frontend Architecture & Web Platform