HTML and CSS Reference
In-Depth Information
UNDERSTANDING RGB COLOR
If you've ever mixed colors in anything from i nger paints to a watercolor set, you have a sense
of what happens when you mix colors. For computer screens, red, green and blue lights are
mixed to generate dif erent colors. For example, if you mix equal amounts of red and green,
you get yellow.
To mix colors for Web pages, dif erent values are mixed using integers, percentages, and
hexadecimal numbers. CSS3 also has a limited number of named colors available that can
help while i guring out the other color-mixing methods. HTML5 and CSS3 have some very
sophisticated elements such as canvas that can do more with color and drawings than has
been possible in previous versions of HTML. h ese advanced elements require a bit of
JavaScript, and you'll i nd them discussed in detail in Chapter 13. For now, we'll get started
with the basics.
USING NAMES
One of the stranger experiences in working with HTML5 and CSS3 is the name set used with
colors. At the root are the 16 standard colors shown in Table 4.1.
Table 4.1
Standard Color Names
Aqua
Black
Blue
Fuchsia
66
Gray
Green
Lime
Maroon
Navy
Olive
Purple
Red
Silver
Teal
White
Yellow
Using the HTML5 that you've learned so far, you can easily create a chart showing all the
colors. (In the “Take the Wheel” section at the end of this chapter, you'll work out how to
re-create the table.) Figure 4-1 shows what they look like on a Web page on a mobile device.
Figure 4-1: The standard CSS3 colors in a Web page.
From this root base, you can include another 131 names that seem to have no rhyme or
reason in terms of why they were selected. h ey're all part of a set created back in the 1980s
called X11. h ey were adopted in the early browsers and have been with us ever since. In the
oi cial W3C documentation, they're listed under Scalable Vector Graphics (SVG), and all the
Search WWH ::




Custom Search