Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS visibility property


May 06, 2021 CSS Reference Manual


Table of contents


CSS visibility property

Description of property definition and use

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 occupy page space.

Default: visible
Inherited: yes
Version: CSS2
JavaScript syntax: object .style.visibility="hidden"

The property value

Value Describe
visible The default. The element is visible.
hidden Elements are not visible.
collapse When used in table elements, this value can be deleted by one row or column, but it does not affect the layout of the table. T he space occupied by rows or columns is left to other content. If this value is used on other elements, it is rendered as "hidden".
inherit Specifies that the value of the visibility property should be inherited from the parent element.

Browser support

CSS visibility property CSS visibility property CSS visibility property CSS visibility property CSS visibility property

The visix property is supported by all major browsers.

Note: Internet Explorer (including IE8) does not have a version that supports the property value "inherit" or "collapse".


To make the element invisible:

h2
{
visibility:hidden;
}

Try it out . . .

CSS visibility property

More instances

Set the table element tocollapse
This example shows how to overlay table elements.


Related articles

CSS tutorials: CSS Display andvisibility