HTML and CSS Reference
In-Depth Information
EXPLANATION
1
Three selectors,
h1
,
h2
, and
h3
, are grouped together. The declaration block en-
closed in curly braces sets the color property to
blue
. Whenever any one of the
h1
,
h2
, or
h3
elements is used in the document, its text will be blue.
2
The declaration block for the
h1
selector consists of a group of properties and val-
ues to further define the font style for this heading.
3
The
font
property, in this example, groups the font values as a list, rather than cre-
ating individual property/value pairs as done on line 2.
4
Now the
h1
tag is tested to see if the style was applied, and it is!
5
The style for the
h2
tag is tested and it has been applied.
6
The only style set for the
h3
tag is a blue font, and that's all we get, as shown in
Figure 14.2.
Figure 14.2
Grouping selectors and declarations for
h1
,
h2
, and
h3
HTML elements.
In the previous examples,
font-family
and
color
are properties (also called attributes),
and assigning values to them defines the style of the document. Listed in Table 14.1 are
some of the properties commonly used in style sheets. Many of these properties are used
in the style sheets defined throughout this chapter and later as properties of the style
object used with JavaScript. The Web Design Group provides a complete listing of this
information at
http://www.htmlhelp.com/reference/css/properties.html
.