CSS visibilityProperty
Example
Make the <h2> element invisible:
h2
{
visibility:hidden;
}
{
visibility:hidden;
}
Try it Yourself »
More examples at the bottom of this page.
Attribute definition and usage notes
The visibility property specifies whether 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 page space.
| Default value: | visible |
|---|---|
| Inherited: | yes |
| version: | CSS2 |
| JavaScript Syntax: | object.style.visibility="hidden" |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the visibility property.
Note:: Internet Explorer (including IE8) has no version that supports the property values "inherit" or "collapse".
Property value
| Value | Description |
|---|---|
| visible | Default value. The element is visible. |
| hidden | The element is invisible. |
| collapse | When used in table elements, this value can remove a row or column, but it does not affect the table layout. The space occupied by the row or column is left for other content. If this value is used on other elements, it will render as "hidden". |
| inherit | Specifies that the value of the visibility property should be inherited from the parent element. |
More Examples
Set the table element to collapse
This example demonstrates how to make table elements overlap.
Related Articles
CSS Tutorial:CSS Display and visibility
other extensions