| Inherited | Initial | Version |
|---|---|---|
| Yes | visible |
CSS2, 2.1 |
| IE8+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Partial | Buggy | Partial |
Syntax
Description
This property specifies whether an element is visible—that is, whether the box(es) that are generated by an element are rendered.
Note that even if a box in the
normal flow is hidden, it still affects the layout of other elements,
unlike the behavior that occurs when we suppress box generation altogether
by setting display to none.
Descendant boxes of a hidden box will be visible if their
visibility is set to visible,
whereas descendants of an element for which display is
set to none can never generate boxes of their
own.
The initial value and the inheritability were changed in CSS2.1 to address the previously undefined state for the root element.
Example
This style rule makes the element with
ID "dynamic" generate an invisible box. It can be made
visible using client-side scripting:
#dynamic {
visibility: hidden;
}
Value
visibleThe value
visiblemakes the generated boxes visible.hiddenThe value
hiddenmakes the generated boxes invisible without removing them from the layout. Descendant boxes can be made visible.collapseThe value
collapseis only meaningful for certain internal table objects: rows, row groups, columns, and column groups. It causes the object to be removed from the display; the space it occupied will be filled by subsequent siblings. This doesn’t affect the table layout in any other way, so the user agent doesn’t have to recompute the layout of the table. If a spanned row or column intersects the collapsed object, it is clipped. When it’s specified for any other element than these internal table objects,collapsecauses the same behavior ashidden.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Partial | Partial | Partial | Full | Full | Full | Full | Full | Full | Partial | Partial | Partial | Partial | Buggy | Buggy | Buggy | Partial |
Internet Explorer for Windows versions up to and including 7:
- don’t support the value
collapse - don’t support the value
inherit - don’t allow descendant boxes of an element whose
visibilityvalue ishiddento be made visible if the ancestor has a layout
Opera up to and including version 10 treat the value
collapsed as hidden for all
elements.
Safari versions up to and including 4.0 and Chrome
versions up to and including 3 don’t support the value
collapse.
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.




