HTML and CSS Reference
In-Depth Information
with other selectors, separated by commas, as in the third example. The
only restriction on classes is that they cannot be nested; for example,
p.equation.centered is not valid.
[*] Due to its support of JavaScript stylesheets, Netscape 4 cannot handle class names that happen to
match JavaScript keywords. The class abstract , for instance, generates an error in Netscape 4.
Accordingly, the first rule in the example creates a class of paragraph
styles named abstract whose text is italic and indented from the left and
right margins by 0.5 centimeters. Similarly, the second paragraph style
class, equation , instructs the browser to center the text and to use the
Symbol typeface to display the text. The last style rule creates a style
with centered text and 0.5-centimeter margins, applying this style to all
level-1 headers as well as creating a class of the <p> tag named centered
with that style.
To use a particular class of a tag, you add the class attribute to the tag,
as in this example ( Figure 8-4 ):
<p class=abstract>
This is the abstract paragraph. See how the margins are indented?
<h3>The equation paragraph follows</h3>
<p class=equation>
a = b + 1
<p class=centered>
This paragraph's text should be centered.
Search WWH ::

Custom Search