CSS Visibility Property

CSS Visibility Property (visible, hidden, inherit, initial): To specify the element visible or not we use visibility property.

NOTE: The hidden elements occupy the space on the page for that you can use display property which can hide and remove the element.

CSS Visibility Property Details

Default value Visible
Inherited Yes
Animatable Yes
Version CSS2

CSS Visible Property JavaScript Syntax


CSS Visible Property Syntax

visibility: visible|hidden|collapse|initial|inherit;

CSS Visible Property values

Visible Default Value For the element to be visible.
hidden The element may be hidden but occupies the space. Collapse used only for table rows, row groups, columns, column groups. It may remove a row/column, but does not affect the table layout. This space can be available for other content. If a collapse is used on other elements, it simply is like “hidden”.
Initial Sets the property to its default value.
Inherit Inherits the property from its parent element.

CSS Visible Property Example

<!DOCTYPE html>
table, td {
border: 1px solid black;
tr.collapse {
visibility: collapse;
<h1>The visibility Property</h1>
<tr class="collapse">

CSS Visible Property Example Output

CSS Visible Property Example Output