O'Reilly logo

Learning Web Design, 3rd Edition by Jennifer Niederst Robbins

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

CHAPTER 13 COLORS AND BACKGROUNDS

(Plus Even More Selectors and External Style Sheets)

IN THIS CHAPTER

Color names in CSS

Specifying RGB color values

Foreground and background colors

Pseudoclass and pseudoelement selectors

Adding tiling background images

Controlling the repeat and position of background images

External style sheets

Style sheets for print and other media

Did you happen to see the Web back in 1993? It was a fairly dreary affair back then, where every background was gray and all the text was black. Then came the Netscape Navigator browser and, with it, a handful of attributes that allowed rudimentary (but welcome) control over font colors and backgrounds. For years, we made do.

But thankfully, now we have style sheet properties that blow those old attributes out of the water. So if you happen to view the source of a web page and see attributes such as bgcolor, background, link, and vlink floating around, ignore them. They are relics of the past. Believe me, you’re much better off without them.

We’re going to cover a lot of ground in this chapter. Of course, I’ll introduce you to all of the properties for specifying colors and backgrounds. This chapter also rounds out your collection of selector types and shows you how to create an external style sheet as well as a style sheet just for print. Oh, and there will be cabbages...lots and lots of cabbages (you’ll see).

Our first order of business is to talk about the options for specifying color in CSS, including a primer ...

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