18.6. Controlling Visibility

You can use the visibility property to control whether an element is visible in the user agent. This property has the following syntax:

visibility:  visible | hidden | collapse;

The first two values accomplish exactly what their names imply: visible makes the affected element(s) visible in the user agent, and hidden hides them (makes them invisible). Setting this property to the value collapse will have the same effect as hidden on any element except for table columns or rows. If this value is used on a table row or column, the content in that column or row is removed from the table and that space is made available for other content.

You can use positioning, sizing, and visibility properties with JavaScript to create impressive animations in your document. See Chapters 28 and 29 for examples of this and other automation techniques using Dynamic HTML.

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.