Block Elements

In contrast to inline elements, an element set to display:block is separated from its siblings, generally by a line break. For example, in HTML, paragraphs and headings are block elements. In Examples Example 13-1 and Example 13-2, the dish, directions, and story elements were all formatted with display:block.

CSS 2.1 adds an inline-block value that formats the element’s contents as if it were a block-level element, but formats the element itself as if it were an inline element. This normally just means there’s extra margins and padding around the element’s content, but no line breaks before or after it.

Get XML in a Nutshell, 3rd Edition 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.