16

Using Colors and Backgrounds

In This Chapter

arrow Using color keywords

arrow Reading hex codes

arrow Working with backgrounds

The web would be a pretty drab place without color. Imagine watching your favorite cat videos in grayscale. Life on the web just wouldn’t be nearly as much fun. This book, in fact, wouldn’t be as much fun in black and white, which is the primary reason it’s printed in full color.

Fortunately, we don’t need to live in a gray world. Your computer, laptop, tablet, or smartphone is capable of displaying millions of different colors. CSS is capable of instructing it to display those colors in infinite combinations. In this chapter, we show you the different ways to specify colors in CSS, how to assign colors to elements, and how to work with backgrounds.

Defining Color Values

CSS defines color values in two ways:

check.png Name: You choose from a limited list.

check.png Number: Pick the exact amounts of each of the primary colors to create the precise colors that you need.

Color names

The CSS3 ...

Get Beginning HTML5 and CSS3 For Dummies 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.