Previous Example-|-Next Example-|-Return to Chapter Listing
Example 14.13:
A Few Style Examples
[This example works with Netscape Navigator 4. It won't work with Netscape Navigator 2 or 3, or Internet Explorer 3.]
This document contains a few examples of JavaScript styles.
Here's a normal H2 header.
... and an H3.
Now we'll use the style tags to modify the H2 and H3 headers, including giving the H3 text a background color...
Here's another level 2, in a different color.
... and a level 3.
Now we'll use a class to modify color and font weight, and create a tag that changes text background color...
Here's a brightly displayed paragraph.
This level 3 header can also be made bright.
Here's a paragraph with some bright text in the middle.
Here's a bright level 2 header.
This paragraph has both a class and an ID.
Now we'll create a more complicated class that creates a box around text that it's applied to, and an ID that applies space around the text...
This is a normal paragraph.
This text paragraph has a border, because the box class has been applied.
This text paragraph has a border, and larger space around the text, because it has both the box class and the padded ID.
Here are all the text and style tags:
Here's a normal H2 header.
... and an H3.
Now we'll use the style tags to modify the H2 and H3 headers, including giving the H3 text a background color...
Here's another level 2, in a different color.
... and a level 3.
Now we'll use a class to modify color and font weight, and create a tag that changes text background color...
Here's a brightly displayed paragraph.
This level 3 header can also be made bright.
Here's a paragraph with some bright text in the middle.
Here's a bright level 2 header.
This paragraph has both a class and an ID.
Now we'll create a more complicated class that creates a box around text that it's applied to, and an ID that applies space around the text...
This is a normal paragraph.
This text paragraph has a border, because the box class has been applied.
This text paragraph has a border, and larger space around the text, because it has both the box class and the padded ID.
Previous Example-|-Next Example-|-Return to Chapter Listing