HTML and CSS Reference
In-Depth Information
To document the style sheet:
1. At the top of the file, insert the following style comments, as shown in Figure 3-8:
/*
Sunny Acres Style Sheet
Author: your name
Date: the date
*/
Figure 3-8
Entering style sheet comments
2. Save your changes to the file.
Next, you'll link the Sunny Acres home page to this new style sheet.
To link to the sa_styles.css file:
1. Return to the home.htm file in your text editor.
2. Directly below the link element for the sa_layout.css file, insert the following:
<link href=”sa_styles.css” rel=”stylesheet” type=”text/css” />
3. Save your changes to the file.
Defi ning Color in CSS
The fi rst part of your style sheet will focus on color. If you've worked with graphics soft-
ware, you've probably made your color selections using a graphical interface where you
can see your color options. Specifying color with CSS is somewhat less intuitive because
CSS is a text-based language and requires colors to be defi ned in textual terms. This is
done through either a color value or a color name.
RGB Color Values
A color value is a numerical expression that describes the properties of a color. To bet-
ter understand how numbers can represent colors, it can help to review some of the
basic principles of color theory and how they relate to the way colors are rendered in a
browser.
In classical color theory, all colors are based on adding three primary colors—red,
green, and blue—at different levels of intensity. For example, adding all three primary
colors at maximum intensity produces the color white, while adding any two of the
three primary colors at maximum intensity produces the trio of complementary colors—
yellow, magenta, and cyan (see Figure 3-9).
 
Search WWH ::




Custom Search