HTML and CSS Reference
In-Depth Information
Figure 8-4. Use classes to distinguish different styles for
the same tag
For each paragraph, the value of the
class
attribute is the name of the
class to be used for that tag.
8.3.2. Generic Classes
You also may define a class without associating it with a particular tag
and apply that class selectively through your documents for a variety of
tags. For example:
.italic {font-style: italic}
creates a generic class named
italic
. To use it, simply include its
name with the
class
attribute. For instance,
<p class=italic>
and
<h1
class=italic>
create an italic paragraph and level-1 header, respect-
ively.