CSS2 » Properties » visibility

Version: Level 2

Compability: IE4+  N6

Syntax:
visibility : collapse | hidden | visible
visible
The visible value specifies that the element is visible on the page.
hidden
The hidden value specifies that the element is not visible on the page.
collapse
The collapse value is primarily used to hide rows or columns in table elements. The hidden row or column space can be used for other content. For other types of elements, it has the same effect as the hidden value.

The visibility property is used to create dynamic displays. It determines whether an element is visible or invisible. By invisible, we mean that the element is fully transparent, but that the element still occupies a place on the page and other content may not fill that space. This property is not inherited.

The display property can be used to make an element invisible and also specifies that nothing can take up space in the layout.

Examples

Code:
p {visibility: hidden;}
br {visibility: visible;}
Language(s): CSS2
Code:
<img src="/images/guru.gif" style="visibility: visible;">
<img src="/images/guru.gif" style="visibility: hidden;">
<img src="/images/guru.gif" style="visibility: visible;">
Explanation:

Note that only the first and third Guru images are visible, and that the space where the second image should be, while reserved for the image, is empty.

Language(s): CSS2

See Also: