CSS Tutorial

CSS (Cascading Style Sheets) is used to control everything from the size and colour of the font used on your website, to the colour of the scrollbars. In this tutorial I will explain the basics and how to use it.

There are two ways to use stylesheets on your websites. Either External (where you put a link to a separate .css file on every page) or internal (where you list all the .css values on every page.) I prefer external as it's easier to modify when you want to update your site/change layouts. With external, you make a new file, enter all your css attributes into the file then save it as a .css file and put the link to the file in the html section of every page on your website. When you want to update your website, you just open the .css file and change the values in there, and it will automatically change it for the rest of the website. Whereas with an internal stylesheet, to update your website you would need to open every page you have for your website and change all the css individually on every page. It's a lot more time consuming and tedious.

So, onto what a stylesheet looks like and how to use it. I will be showing you how to use an external stylesheet.


This is what my stylesheet looks like:

a:link{color:#E2A43A;text-decoration:underline;}
a:visited {color: #E2A43A; text-decoration: underline;}
a:active{color:#E2A43A;text-decoration:underline;font-weight:bold;}


body {
overflow:auto;
scrollbar-face-color: #331105;
scrollbar-highlight-color: #331105;
scrollbar-shadow-color: #331105;
scrollbar-3dlight-color: #E2A43A;
scrollbar-arrow-color: #E2A43A;
scrollbar-track-color: #331105;
scrollbar-darkshadow-color: #E2A43A;
background-color: 0C0000;
}


body, tr, td, p {
font-family: arial;
font-size: 10pt;
color: #E2A43A;
}


Now this probably all looks like mumbo jumbo at this stage. But I'll explain what everything means.

a:link - the style of your links
a:visited - the style of the links that have already been clicked on
a:active - the style of the link you have just clicked on

overflow: what will happen when your page is too long and it needs a scrollbar
scrollbar-face-color: the colour of the scrollbar
scrollbar-highlight-color: the colour of the highlight around the scrollbar
scrollbar-shadow-color: the colour of the shadow around the scrollbar
scrollbar-3dlight-color: the colour of the around the scrollbar
scrollbar-arrow-color: the colour of the arrow at the bottom of the scrollbar
scrollbar-track-color: the colour of the track behind the scrollbar
scrollbar-darkshadow-color: the colour of the dark shadow around the scrollbar
background-color: the background colour of the page

font-family: the name of the font, ie. Arial, Times New Roman
font-size: size of the font
color: colour of the font


These are the basic things you will need for your website. Of course, there are more things you can add, but these will do for now. I should also say that the scrollbar properties only show up in Internet Explorer, so for people using other browsers like Firefox, the scrollbar will just have the default properties for every website.

So, to make your stylesheet, open up Notepad. Copy & paste whatever attributes that you think you might need from the ones I listed. Then just edit the hex codes accordingly. This is a good place to start for hex codes if you don't have PS. If you do have PS, click on the foreground colour, choose your colour by sliding the colour bar up or down and clicking inside the box for different shades, and it will give you the hex code. Then save your file as stylesheet.css

Now, to link the css file in your page go to the html part (if you're using Frontpage click on the HTML button down the bottom next to Normal) Find the bit up the top where it says:

<html>
<head>
<title>Title of your website here</title>
</head>

To add your external stylesheet, you need to add this:
<LINK REL="stylesheet" TYPE="text/css" HREF="stylesheet.css">
under the </title> tag and before the </head> tag. So the full code would look like this:

<html>
<head>
<title>Title of your website here</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="stylesheet.css">
</head>


Add that to every page you want to change the properties of,  and you're set. I hope you find this tutorial useful, and feel free to email me or tag me if you have any comments about it.