HTML and CSS Reference
In-Depth Information
To format the text and background colors:
◗
1.
Return to the
sa_styles.css
file in your text editor.
◗
2.
Directly below the style comments, insert the following style rules, as shown in
Figure 3-12:
Make sure you end every
style property value with
a semicolon to sepa-
rate it from other style
properties.
/* Body styles */
body {
background-color: white;
}
About 8% of all men
and 0.5% of all women
have some form of color
blindness. Because red-
green color blindness is
the most common form
of color impairment, you
should avoid using red
text on a green back-
ground or vice versa.
/* Heading styles */
h2 {
background-color: rgb(0, 165, 0);
color: white;
}
Figure 3-12
Setting the foreground and background colors
set the background color of the
page body to wh
i
te
display the text of h2 headings in
white on a green
background
RGB color
valu
e for green
◗
3.
Save your changes to the file and then reload the
home.htm
file in your Web
browser. As shown in Figure 3-13, the
h2
heading text appears in white on a
green background.
Figure 3-13
Formatted h2 headings