More "Try it Yourself" examples below.
The visibility property specifies whether or not an element is visible.
Tip: Even invisible elements take up space on the page. Use the display property to create invisible elements that do not take up space!
Default value: | visible |
---|---|
Inherited: | yes |
Animatable: | yes. Read about animatable |
Version: | CSS2 |
JavaScript syntax: | object.style.visibility="hidden" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
visibility | 1.0 | 4.0 | 1.0 | 1.0 | 4.0 |
Value | Description | Play it |
---|---|---|
visible | Default value. The element is visible | Play it » |
hidden | The element is invisible (but still takes up space) | Play it » |
collapse | Only for table elements. collapse removes a row or column,
but it does not affect the table layout. The space taken up by the row or column
will be available for other content. If collapse is used on other elements, it renders as "hidden" |
Play it » |
initial | Sets this property to its default value. Read about initial | Play it » |
inherit | Inherits this property from its parent element. Read about inherit |
This example demonstrates how to make a table element collapse:
CSS tutorial: CSS Display and visibility
HTML DOM reference: visibility property