Visibility in CSS: This visibility property in CSS is employed to describe whether the components are visible or not.

Note: An invisible component also grabs the space over the page. If we use display property, we can create hidden component, which does not grab any space.
Syntax:

Visibility Attributes

AttributesDescription
visibleThis attribute is used as a default value. The visible attribute describes that a component is visible.
hiddenIt describes that the component is invisible (still grab the space).
collapseThis value is only applied to various tables. It can also be applied to remove the row and the column, but it will not disturb the layout of a table. The space grabbed by the column and row will be applicable for various other contents. When collapse value is applied to any other content, it delivers as “hidden.”
initialThis value is employed to set-up the visibility attribute to its default value.
inheritThis value can acquire this attribute from the parent element.

Visibility Example

Output:

CSS Visibility

JavaScript Syntax:

Example:

Output:

CSS Visibility

Pin It on Pinterest

Share This