You are here: Reference > CSS > properties > visibility

visibility property

Browser support:
Specifies whether the element is visible.
This property is useful if you want to hide or show the contents of an element. Similar to display property, but if you set the visibility property to 'hidden', only the contents of the element will be invisible, the element stays in its original position and size. The display property with value 'none' hides the entire element.
JavaScript page for this property: visibility. You can find other example(s) there.

Possible values:

 One of the following values: 
collapse
If used on cell elements, 'collapse' has the same meaning as 'hidden'.
hidden
Element is hidden.
inherit
Takes the value of this property from the computed style of the parent element.
visible
Element is visible.
Default: visible.

Example HTML code 1:

This example illustrates the use of the visibility property:
<head>
    <style>
        .visible {
            visibility: visible;
        }
        .hidden {
            visibility: hidden;
        }
    </style>
</head>
<body>
    <div class="hidden">A hidden element</div>
    <div class="visible">A visible element</div>
    There is an invisible element at the first line of the page
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content