CSS visibility Property

❮ Previous Reference Next ❯

Example

.example1 {
  visibility: visible;
}

.example2 {
  visibility: hidden;
}





Hello World!

Hello World!

Hello World!


Meaning

The visibility property shows or hides an element without changing the layout of a document.

The property can also hide rows or columns in a <table>.

Note: To both hide an element and remove it from the document layout, set the display property to none instead of using visibility.

Default value:visible
Inherited:Yes
Animatable:Yes
Version:CSS2
JavaScript syntax:
object.style.visibility="visible|hidden|collapse|initial|inherit|revert|revert-layer|unset";



Standard Syntax

visibility: visible|hidden|collapse|initial|inherit|revert|revert-layer|unset;



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Property Values

The following table describes the values of this property.

Value Description
visible This is default value. The element is visible.
hidden Sets the element into hidden (but still takes up space).
collapse Only for certain internal table objects: rows, row groups, columns and column groups. It removes the objects, but it does not affect the table layout in any other way. The space occupied by the table object will be filled by subsequent siblings.

If collapse is specified for other element, it causes the same behavior as hidden.

initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  visibility: visible;
}
❮ Previous Reference Next ❯