XML technologies / CSS / Advanced websites with CSS / CSS property reference / visibility

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property visibility describes whether an element is visible on a page. A hidden element is not displayed but still occupies its space in the page layout. To remove it from the layout too, set its property display to none.

Inherited: yes

See also: display

Values

The property visibility accepts the following constants:

  • collapse: When applied in a table to a row (tr), row group (thead, tbody, tfoot), column (col) or column group (colgroup), it hides them and shrinks the table accordingly. For other elements it acts like hidden.

  • hidden: The element is invisible but retains its place in the layout.

  • visible: The element is displayed visibly.

Default value: visible

Compatibility

CSS version: 2

Works in all current browsers, but the constant collapse is not supported by any current browser.

Netscape 4 supports visibility only for elements whose position is declared with absolute or relative.

Example

The following rule hides elements of the class aktiv. DHTML can make them visible again in response to user actions, producing an attractive interactive effect.

.aktiv {
 visibility: hidden;
}

  

 

 

 

back to top