visibility
The ‘visibility’ property specifies whether the boxes generated by an element are rendered. Invisible boxes still affect layout. Values have the following meanings:
- visible
- The generated box is visible.
- hidden
- The generated box is invisible (fully transparent, nothing is drawn), but still affects layout. Furthermore, descendants of the element will be visible if they have ‘visibility: visible’.
- collapse
- Please consult the section on dynamic row and column effects in tables.
If used on elements other than rows, row groups, columns, or column groups, ‘collapse’ has the same meaning as ‘hidden’.
Note that the two first boxes are not removed from the flow; to suppress box generation altogether, we would set the ‘display’ property to ‘none’.
Since CSS2.1, the ‘visibility’ property is defined to inherit, and descendant elements can override an ancestor’s hidden visibility.
Elements styled with visibility:hidden
are ignored by (most) screen-readers.