visibility
top
TOC
Collapse the table of content
Expand the table of content

visibility

Sets whether the content of the object is displayed.

Syntax

{ visibility: sVisibility }

Possible values

sVisibility

String that specifies one of the following values:

inherit

Default. Object inherits the visibility of the next parent object.

hidden

Object is hidden.

visible

Object is visible.

The property has a default value of inherit. The cascading style sheet property is not inherited.

Remarks

Unlike an object with its display property set to none, objects that are hidden using the visibility property still reserve the same physical space in the content layout as they would if they were visible. You can change the visibility through scripting to show and hide overlapping content based on user interaction.

Examples

The following example uses the visibility property to determine whether the object is visible. This example uses two calls to an embedded (global) style sheet to hide and then show the image when the user moves the pointer over and then off the text:

<style>
    .vis1 {visibility:visible}
    .vis2 {visibility:hidden}
</style>
</head>
<body>
<img id="oSphere" src="sphere.jpg">
<p onmouseover="oSphere.className='vis2'" 
   onmouseout="oSphere.className='vis1'">
   Move the mouse over this text to make the sphere   
   disappear.</p>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 2 (CSS2) Ee371214.xtlink_newWindow(en-us,Expression.40).png.

Applies to

a, address, applet, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, div, dl, dt, em, embed, fieldset, form, hn, hr, html, i, iframe, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, object, ol, p, s, select, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

See also

Concepts

display

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2016 Microsoft