Visibility vs Display None
Learn when to use visibility: hidden versus display: none and how each affects layout.
Three Ways to Hide Elements
CSS provides three common methods to hide elements, each with different effects on layout, accessibility, and interaction:
display: nonevisibility: hiddenopacity: 0
display: none
The element is completely removed from layout. It occupies no space, is not interactive, and is not read by screen readers (for most implementations). The element still exists in the DOM.
.hidden {
display: none;
/* element disappears from layout */
}All lessons in this course
- Block vs Inline vs Inline-Block
- Visibility vs Display None
- Overflow: Scroll Clip and Auto
- CSS Reset and Normalize