External CSS Style Sheets

When a CSS style sheet or a set of sheets for a web site is developed and refined, you can save a great deal of time by creating a CSS style sheet. As examples in previous chapters have shown, several different web pages can use the same style sheet saving time and bandwidth.

Follow this next set of steps to create an external CSS style sheet:

  1. Write your styles as you would normally, except do not include any HTML tags other than those in CSS definitions.

  2. Save the file as a text file with .css extension.

  3. In the <head> container of your HTML page, enter this tag:

    <link rel="stylesheet" href="URL.css"> 

That’s all there is to it. Design once; use often! The following two scripts show an example of a style sheet and a page ...

Get JavaScript Design 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.