External CSS files

Storing the style information in a external file has several major advantages

Example
We will need two files an html file which calls the external style sheet file.

We create the style sheet file first

Create the file mystyle1.css with the code shown below.
/* This is what a style sheet comment looks like. It is ignored by the browser. */
.fred {background-color:red; font-size:30pt;}

Calling the External Style Sheet

Now create and save an html document which calls mystyle1.css use the following code

<head>
<link rel="stylesheet" type="text/css" href="mystyle1.css" />
</head>
<body>
this is an example of a link to an <span class='fred'> external style sheet </span>
</body>

Exercise
Use the div tag to set the background-color of some text to deepskyblue, text color to wheat and font-size to 30pt