Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS visibility property

CSS visibility property

Example

Make

Make an element invisible:

h2

{

visibility:hidden;

}

Try it »

There are more examples at the bottom of this page.


Property definition and usage

The visibility property specifies whether an element is visible.

**Tip:** Even invisible elements occupy space on the page. Use the "display" property to create invisible elements that do not occupy space on the page.

Default value: visible
Inherited: yes
Version: CSS2
JavaScript syntax: object.style.visibility="hidden"

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the visibility property.

Note: Note: No version of Internet Explorer (including IE8) supports the "inherit" or "collapse" values.


Attribute values

Value Description
visible Default value. The element is visible.
hidden The element is invisible.
collapse When used on table elements, this value removes a row or column but does not affect the table's layout. The space occupied by the row or column is left for other content. If this value is used on other elements, it renders as "hidden".
inherit Specifies that the value of the visibility property should be inherited from the parent element.

More examples

Set table elements to collapse
This example demonstrates how to collapse table elements.


Related Articles

CSS Tutorial: CSS Display and visibility