Tuesday, September 14, 2010

Defining font colors

In CSS, the color property value defines the foreground color of the relevant CSS element,
which for text sets its color. This can be set using hex, keywords, or RGB. The following
examples show each method in turn, and all have the same result: setting
paragraphs to black.
p {
color: #000000;
}
p {
color: black;
}
p {
color: rgb(0,0,0);
}Declaring colors using RGB is rare in web design—hex is most popular, especially because
CSS supports so few keywords (see the section “Working with hex” in Chapter 4).
Remember to test your choices on both Windows and Mac, because there are differences
in the default color space for each platform. In general terms, the Mac default display settings
are brighter (or Windows is darker, depending on your outlook on life); if you use
subtle dark tones on the Mac, or very light tones on Windows, the result might be tricky to
view on the other platform. This should cause few problems with text, but some designers
insist on rendering text with very little contrast to the background color, and this ends up
being even harder to read on a different platform from the one on which it was created.

No comments:

Post a Comment