display:none vs visibility:hidden vs Clip Pattern
You'll learn how different CSS hiding techniques affect whether screen readers can access your content, and why this matters for accessibility.
The Three Ways to Hide Content
When you need to hide something visually, CSS offers several approaches—but they don't all work the same way for assistive technology.
display:none
This completely removes the element from the document flow and from the accessibility tree. Screen readers won't announce it at all.
.hidden {
display: none;
}
Use when: Content should be hidden from everyone, including screen reader users (like closed dropdown menus or inactive modal dialogs).
visibility:hidden
This keeps the element's space in the layout but makes it invisible. Like display:none, it also hides content from screen readers.
.invisible {
visibility: hidden;
}
Use when: You need to preserve layout spacing but hide content from all users.
The Clip Pattern (Visually Hidden)
This is the technique you learned in the previous lesson. It hides content visually but keeps it accessible to screen readers:
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
clip: rect(0, 0, 0, 0);
overflow: hidden;
}
Use when: Content should be available to screen reader users but hidden from sighted users (like "Skip to content" links or extra context for form labels).
Think of It This Way
display:none= Removing a book from the library entirelyvisibility:hidden= Covering a book with an invisible sheet (it's still on the shelf, taking space)- Clip pattern = Moving the book to the audiobook section (hidden to browsers, accessible to screen readers)
Key Takeaway: Only the clip pattern keeps content accessible to screen readers while hiding it visually—display:none and visibility:hidden hide from everyone.