Displaying and Hiding Elements

The display property is useful for hiding or revealing particular elements. You can also override an element’s natural display type (from block-level to inline, or vice-versa). Or you can display an element as a list item—even without the li tag.

Figure 12.1. Here’s the (X)HTML: three simple paragraphs with an image in each one. The middle paragraph has a class of hide.

Figure 12.2. The only CSS applied here is a 2 pixel bottom margin to the elements. All three paragraphs and their images are visible.

To specify ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide 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.