5.2. Using External and Local Style Sheets

Style rules are most commonly placed in a separate text file on the Web site and referred to through a link in the HTML document. By creating an external file, you greatly simplify the application of the same set of style rules to multiple HTML files on the Web site. Alternatively, you can place the style rules locally in the document HEAD or directly in the body of the document.

External Style Sheets

If you plan to use the same formatting styles in several documents, you can create a separate style sheet in a WWW-accessible file. You can then link this file to HTML documents by using a LINK element in the document HEAD with a REL value of STYLESHEET, an HREF giving the location, and a TYPE of text/css ...

Get Core Web Programming, Second Edition 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.