External CSS Stylesheets

Introduction

This article outlines how to create external stylesheets and how to link an external stylesheet to every page in a site.

Creating an External CSS Stylesheet

Creating an external CSS stylesheet is just the same as anything else. Just open up notepad or a text editing tool and start typing in CSS, don't worry about including the <style type="text/css"> tag because the text will be saved as a .css, so there's no reason to specify the language again. Once you have written everything out, save it as something.css.

Linking External CSS Stylesheets

To link an external stylesheet to a page, simple type <link rel="stylesheet" type="text/css" href="something.css"> between the <head> tags. Then, you can copy and paste this line of code in every page of the site, saving space and time.

Benefits of Using External Stylesheets

There are many benefits of using external stylesheets over internal stylesheets. First, it makes layout switching much easier because you just need to change the something.css file, not every single page. It will automatically use the new styles. Plus, using an external stylesheet saves space and memory. Instead of typing out all the styles for every page on every page, you only need it written out once.

Sources / For More Information