Little Web Hut

CSS 2.1 Reference: visibility Property

CSS visibility Property
Syntax
selector {visibility: value;}
  • value is specified by using one of the following keywords: visible, hidden, collapse, or inherit.
Usage

The visibility property is used to specify whether the element should be visible or hidden. If the element is hidden it will still occupy space in the layout. If it is desired that the element be hidden and also not occupy any space, then use the display property set to none instead of the visibility property.

This property is specified by using a keyword according to the syntax shown above.


CSS Example: The visibility property is set to hidden for the span tag.
  span {visibility: hidden;}
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • visible - The element is visible.
  • hidden - The element is hidden but it will still occupy space in the layout. If it is desired that the element be hidden and also not occupy any space, then use the display property set to none instead of the visibility property.
  • collapse - Used with particular table elements (rows, row groups, columns, column groups) to remove entire rows or columns. This value has the same behavior as hidden when used with non table elements.
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To All elements
Inherited Yes
Initial Value visible


visibility Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe visibility property is set to hidden for the span tag.