free for webmasters
webmaster resources

Path = Home > Using CSS > How To Use External Style Sheets On Your Website

How To Use External Style Sheets On Your Website

An external Style Sheet enables you to use one style for all or part of your site. The main advantage is that you can make sitewide changes by just changing the contents of the style sheet. For example, if you decide to change the background color of your site, you just need to change it in your external file, and it will be changed on all the pages that use that style sheet.

Another advantage of using external style sheets instead of enbedded ones is that you can use different style sheets for different browsers.

You can use an external style sheet by calling it from within your document. Place the following code in the <HEAD> section of your page. Normally you would place it just before the closing </HEAD> tag.

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

where stylesheet.css is the name of your style sheet. You can of course call it any name you wish, but it must end in .css

Note that do not need the opening and closing tags

<style type="text/css"> </style>

in your external file as they are included in the code that calls the file.

So a simple external style sheet file would look like this :-

h1 {
font: 18px Arial, Helvetica, sans-serif;
color: #00FF00;
}