B.32. display

In HTML, there are different types of elements. div and blockquote, for example, are both block elements, while strong and em are both inline elements. For each type of element, a browser supports a "display mode". All block elements are essentially displayed the same way, just with varying margins, padding, borders, etc. by default.

The display property lets you set the "display mode" for an element. For example, you can set a hyperlink (a) to be displayed as a block instead of inline text.

The most common use for the display property is to show and hide portions of an HTML document. Setting display to none causes the element not only to be hidden (as with the visibility property), but not to occupy any space on the page either. ...

Get HTML Utopia: Designing Without Tables Using CSS 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.