Using Color

Unless you’re really into television reruns or artsy photography, you probably don’t see much of anything in black and white these days. The world’s a colorful place, and you may disappoint your visitors if you don’t use color on your Web site.

I touch on color in the earlier section “Fonts,” but you can use color in many places. As time goes by, you will doubtlessly be able to color every element in HTML.

If you use Cascading Style Sheets (CSS), you have much more control over color than you do with normal HTML. There’s an introduction to CSS in Chapter 5 of this book, and you can find out even more in the book Creating Web Sites Bible, by yours truly and my colleague Andrew Bailey (Wiley Publishing).

If you read the section “Fonts,” earlier in this chapter, you already know that you can set the color of a particular set of letters, but you can also set the base color for all the text as well as for a page’s background and its links. The links use three different colors: one for links a visitor hasn’t clicked, one for links that he or she is clicking, and one for links already visited.

You can accomplish all these color changes by setting the values for various attributes of the BODY element:

textText color
bgcolorBackground color
linkUnvisited link color
vlinkVisited link color
alinkColor for a link that someone’s clicking (the active link)

Setting all these attributes ...

Get Building a Web Site For Dummies®, 3rd Edition 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.