Skip to main content

Abstract

This chapter discusses design patterns that put horizontal and vertical space around inline elements, which may contain text, images, objects, controls, and so on. This chapter contains the following design patterns:

  • Spacing shows how to space text and content. It simply groups together the many properties built into CSS that put space around and between blocks, text, and content.

  • Blocked shows how to render an inline element as a block element. This is a very important design pattern that is often combined with other patterns.

  • Nowrap shows how to prevent the browser from wrapping text across lines.

  • Preserved shows how to render whitespace in a document instead of collapsing it.

  • Code shows how to mark up computer code, render it inline, display it as a block, preserve whitespace, and prevent it from being wrapped across lines.

  • Padded Content shows how to put space around inline content to emphasize it.

  • Inline Spacer shows how to insert a horizontal spacer into a line to put a precise amount of distance between content.

  • Inline Decoration shows how to insert a decoration into a line. A decoration is style-not content. It lets you insert a colored background, a textured background, or a background image into the flow. You can put borders around it. You can use it to push content apart, to overlap prior content, and to underlap following content.

  • Line Break shows how to insert four different types of line breaks into your document that can add extra space between lines or shrink the distance between lines.

  • Inline Horizontal Rule shows how to insert a horizontal rule using an inline element. You can style the horizontal rule with images, borders, margins, and so on. This allows you to put extra space between lines, to overlap prior lines, and to underlap following lines. An inline horizontal rule is particularly useful because you can use an inline element anywhere. HTML’s horizontal rule is a block element and has limited styling options.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Michael Bowers, Dionysios Synodinos, and Victor Sumner

About this chapter

Cite this chapter

Bowers, M., Synodinos, D., Sumner, V. (2011). Spacing Content. In: Pro HTML5 and CSS3 Design Patterns. Apress. https://doi.org/10.1007/978-1-4302-3781-5_11

Download citation

Publish with us

Policies and ethics