CSS TUTORIAL



CSS Type of Styling


So far we have used internal styling in CSS. There are two more types of styling used in CSS. The most common way of specifying a style is in a separate file.

Here is how styling is done using an external file.


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


The href="referencestyle.css" specifies the name and the location of the stylesheet file. The Stylesheet file, is itself, a simple text file that contains the style, that we mentioned. The filename of a stylesheet file must end with .css. The content of a typical style sheet CSS File is shwn below.
br />
body {background-color:#b0c4de;}
p {margin-left:30px;}


A real world CSS file contains many declarations of classes, ids for different sections of the website. As an exercise, try to complete one of the examples in the previous pages of the tutorial using external stylesheet.

There is another method of specifying the style - that is inline style. Here is an example of how it is done.

<p style="color:red;margin-left:20px">An inline styling example</p>

In the next page we will check some real life CSS styles. Make sure you are familar with them.