CSS visibility Property

CSS visibility property specifies that whether or not an element is visible.

Usages

The following table outline the usages and version history of this property.

Default value: visible
Applies to: All elements
Inherited: Yes
Version: CSS2
JavaScript Syntax: object.style.visibility = "hidden"

Syntax

Here is a syntax for the CSS visibility property

visibility: visible | hidden | collapse | initial | inherit;

Property Values

The following table describes the values of this property.

Value Description
visible Default. The element is visible
hidden The element is invisible
collapse This value removes row or column, but it does not affect the table layout. It is only for <tr>, <tbody>, <col>, and <colgroup>
initial Sets default value of this property
inherit Inherits this property from its parent element

Examples

The example below shows to sets visibility property.

li.first {
  visibility: visible;
}
li.second {
  visibility: hidden;
}

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 4+
  • Opera 4+
  • Safari 1+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.