Hour Ten: Backgrounds and Background Colors

In Hour 2, "Getting Started with CSS," you learned how to use the background-color property to change the appearance of HTML elements. Background colors can be used to good effect in Web design to group related items together or to highlight important parts of the page. In addition to pure colors, you can also use images as backgrounds for the whole page or for any element on the page.

In this hour, you'll learn

Sample Code

You can download the sample code from each hour as one package or individual files.

Web Links

These are the links presented in this hour, given here for easy reference.

Updates and Errata

The file names given in the source listings for Listing 10.5 and 10.6 are off by one; for example, Listing 10.5 has the comment /* stars-10.6.css */. Also, to view the fixed background, you should load the URL http://www.cssin24hours.com/10/anthem-10.6.html, not anthem-10.7.html.

CSS in 24 Hours
Teach Yourself CSS in 24 Hours was published in 2002 by SAMS Publishing and provides a solid introduction to Cascading Style Sheets.