Easy Tutorial
❮ Css Colornames Pr Text White Space ❯

CSS visibility Property

Example

Make the <h2> element invisible:

h2 {
    visibility: hidden;
}

Property Definition and Usage

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 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) does not support the property values "inherit" or "collapse".


Property 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 layout. The space occupied by the row or column is available for other content. If 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


Related Articles

CSS Tutorial: CSS Display and Visibility

❮ Css Colornames Pr Text White Space ❯