CSS visibility property

Examples

Make <h2> element is not visible:

h2
{
visibility: hidden;
}



In the bottom of this page for more examples.

Attribute definitions and instructions

visibility attribute specifies whether an element is visible.

Tip: Even if the invisible elements will occupy space on the page.Please use the "display" property to create does not occupy space on the page is not visible elements.

Defaults: visible
inherit: yes
version: CSS2
JavaScript syntax: object .style.visibility = "hidden"


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the visibility property.

Note:: Internet Explorer (including IE8) does not support the version attribute value "inherit" or "collapse".


Property Value

value description
visible Defaults. Element is visible.
hidden Element is not visible.
collapse When used in a table element, this value can delete a row or column, but it does not affect the layout of the table. Space is occupied by the row or column will be left to other content usage. If this value is used in the other elements it will be rendered as "hidden".
inherit Provisions should inherit the visibility attribute value from the parent element.


Examples

More examples

The form element is set to collapse
This example demonstrates how to make a table element superimposed.


related articles

CSS tutorial: CSS Display and visibility