Step 5: Styling text with CSS

The page has been styled with CSS

You’re almost done! All that remains is to change the text font to a “sans-serif.” The hyperlinks on the left also need a lighter background. It’s hard to read blue-on-blue!

Once upon a time we would have had to use <FONT> tags to change the text appearance. As for the hyperlink backgrounds, we would have had to either change the link colors — risking confusion for our users, who are used to blue “new” links and purple “used” links — or make images of both the “new” and “used” link text in the colors we wanted. Then we’d use JavaScript routines to make the images swap. Changing the link text would mean editing the text images again.

We will learn that JavaScript technique later. But for now we can accomplish everything we need with CSS. Just embed a stylesheet container in the document head (never in the body), like this:

    <STYLE type="text/css">
    <!--
    
        /* CSS rules will go here */
    
    -->
    </STYLE>

Here are the rules I chose to include in my stylesheet:

  body { font: normal normal 1em verdana,arial,helvetica,sans-serif; }
  a    { color: blue; background-color: white; }
  p,h1,h2 { margin-left: 5%; }

. . . And a few notes:

Site hosted by Angelfire.com: Build your free website today!