HTML and CSS Reference
In-Depth Information
Figure 3.1 Some of the most common keyword color values, along with their hexa-
decimal, RGB, and HSL equivalents
Here we are applying a maroon background to any element with the task class attribute
value and a yellow background to any element with the count class attribute value.
1. .task {
2. background: maroon ;
3. }
4. .count {
5. background: yellow ;
6. }
While keyword color values are simple in nature, they provide limited options and thus are
not the most popular color value choice.
Hexadecimal Colors
Hexadecimal color values consist of a pound, or hash, # , followed by a three- or six-char-
acter figure. The figures use the numbers 0 through 9 and the letters a through f , upper or
lower case. These values map to the red, green, and blue color channels.
In six-character notation, the first two characters represent the red channel, the third and
fourth characters represent the green channel, and the last two characters represent the
blue channel. In three-character notation, the first character represents the red channel, the
second character represents the green channel, and the last character represents the blue
channel.
If in six-character notation the first two characters are a matching pair, the third and fourth
characters are a matching pair, and the last two characters are a matching pair, the six-char-
acter figure may be shortened to a three-character figure. To do this the repeated character
from each pair should be used once. For example, a shade of orange represented by the
hexadecimal color #ff6600 could also be written as #f60 (see Figure 3.2 ) .
Figure 3.2 Six-character hexadecimal values may be written as three-character hexa-
decimal values when the red, green, and blue color channels each contain a repeating
character
Search WWH ::




Custom Search