Style visibility Property
Style visibility Property
The visibility property is used to either set or return whether an element should be visible. By this, we can hide the content of our element. It is similar to display property. The main difference is that when display:none is set, it will hide the entire element while in the case of visibility:hidden, the element content is invisible but the element stays in its original conditions.
Syntax:-
Its syntax is:- object.style.visibility OR object.style.visibility = visible | hidden | collapse | initial | inherit
Return:-
Its return is:- string containing whether the content of an element is displayed or not
Further Explanation:-
Value | Description |
---|---|
visible | The element is visible. |
hidden | The element is not visible but still affects the layout. |
collapse | The element is not visible when used on a table row or cell. |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |