Changing the Text’s Background

The background refers not to the background of the entire page, but to the background of the specified element. In other words, you can change the background of just a few paragraphs or words, by setting the background of those words to a different color.

Figure 10.25. It’s a good idea to set the background color for every element that you’ve set a foreground color for. Setting the background color of the body element, covers the background of all of its child elements.

To change the text’s background:

1.
Type background:.
2.
Type transparent or color, where color is a color name or hex color (see page 160

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.