Linking to an External Stylesheet

Stylesheets are at their most powerful when you can use a single stylesheet for an entire Web site. This way, you can use a class on many pages and only have to make changes on a single page. I've used this many times, and it's saved my butt more than once when a client's hair was on fire and they needed an immediate change.

It only takes a single line to connect your Web page to a central stylesheet:

<link rel="stylesheet" type="text/css"
    href="shelleystyles.css">

This line is placed anywhere in the header of the Web page. In our case, the shelleystyles.css file would look like Example 8-9.

Example 8-9. shelleystyles.css
 #header { position: absolute; left: 36; top: 31; } #nav { position: absolute; left: 0; ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.