Previous Example-|-Next Example-|-Return to Chapter Listing

Example 14.12:
Creating a Style Class

[This example works with Netscape Navigator 4. It won't work with Netscape Navigator 2 or 3, or Internet Explorer 3.]

In this document we created a style class named bright, then applied that class to the text below. As you can see, its effect depends on the context.

Here's a general class paragraph.

This level 2 header can also be set to the general class.

This level 1 header can also be set to the general class.

Here's a paragraph with some general-class text in the middle.


We put this in the HEAD to create the class called general: <STYLE TYPE="text/javascript"> classes.general.all.color = "green" classes.general.all.fontWeight = "bold" classes.general.H2.color = "gold" classes.general.H1.textDecoration = "blink" classes.general.H1.color = "blue" </STYLE> We used the class like this: <P CLASS="general"> Here's a general class paragraph. </P> <H2 CLASS="general"> This level 2 header can also be set to the general class. </H2> <H1 CLASS="general"> This level 1 header can also be set to the general class. </H1> <P> Here's a paragraph with <SPAN CLASS="general"> some general-class text </SPAN> in the middle. </P>
Previous Example-|-Next Example-|-Return to Chapter Listing