The first thing you need to learn about color is how to specify exactly the color you want; after all, there are a lot of different reds, greens, and blues, and it is important you choose the right ones.
In XHTML there are two key ways of specifying a color:
Hex codes: A six-digit code representing the amount of red, green, and blue that make up the color, preceded by a pound or hash sign # (for example,
Color names: A set of names that represent over 200 colors, such as
red, lightslategray, and
In CSS you can also use values to represent the red, green, and blue values that make up each color.
When you start using hexadecimal codes (or hex codes for short), they can appear a little daunting. The idea that colors are represented by a mix of numbers and letters might seem a little strange, but what follows the
# sign is actually the amount of red, green, and blue that make up the color. The format for hex codes is:
The table that follows provides some examples.
As you might already know, computer monitors work in a color space known as an RGB color space. When a computer monitor is not switched on, the screen is black because it is not emitting any color. To create the image you see onscreen, each of the pixels that make up the screen emits different amounts of the colors red, green, and blue, just like ...