Chapter 8

Decorating Element Colors and Backgrounds

IN THIS CHAPTER

Bullet Learning the oh-so-many ways to apply colors in CSS

Bullet Sprucing up your text with a coat of color

Bullet Creating element backgrounds that are both fancy and schmancy

In this chapter, you investigate the amazing world of CSS colors. You learn various ways to specify colors, and then you put that newfound know-how to work right away using color to style your text. From there you learn how to set a page background color or image. It’s a veritable feast for the eyes, so dive right in.

Picking Out Colors in CSS

When rendering the page using their default styles, browsers don’t do much with colors, other than show link text in a default and familiar blue. But CSS offers a ton of properties, keywords, and functions that enable you to add a splash (or even a torrent, if that’s your thing) of color to your pages.

The next few sections take you through the main ways that CSS offers to specify a color as a property value.

Working with color keywords

CSS defines more than 140 color keywords, which are predefined terms, each of which corresponds to a specific color. Some of the keywords are straightforward and readily grasped, such ...

Get HTML & CSS Essentials 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.