O'Reilly logo

Beginning HTML5 and CSS3 For Dummies by Chris Minnick, Ed Tittel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required