3.2.2 How to Include Classes in Your Documents

In order to use class sheets, you must tell the browser three things:
There exists a class sheet that defines some or all attributes for some or all tags.
Where exactly this list can be found.
What should be done with the list.
Since this information specifies something about the document which should not be shown in the document, it must be included within the <head></head> tags. There are two ways of doing this.
You simply put the whole class sheet in the head tag. This will work, but makes little sense. If you want to change something in a whole set of documents, you still would have to change the class sheet in any document.
You store the class sheet in a different file (called "styles" as discussed before) and make a reference to the file and the document. In other words, you insert a proper link right in the head tag.
To do this, you do not have to mark anything - just press "Insert link" in the "Insert" pull-down menu.
Now go to the file where you stored your class sheet and put the link on it. You probably won't find it, because your menu usually is set to show only HTML compatible documents - change it to "all file types".
Now you have a link to the class sheet and the browser will find it, but that is not yet good enough.
You must tell the browser, what it is supposed to do with that document. Since there are more options of what you can include in the head tags; it is not obvious to the browser without further comment what should be done.
In other words, we now must specify some attributes of the <link></link> tag.
So use F6 in the tag. The attribute list popping up now must get two entries (we will not discuss why; it will to some extent become clear later; if you really need to know, look up the attributes for links in the advanced section)
In the "REL" attribute line write: stylesheet.
This tells the browser what this link is all about. A little program will now be started that overrides the default values of the browser for the attribute with the ones you specified.
In the "Type" attribute line write: text/css.
This tells the browser what kind of MIME type you have, i.e. what kind of data format. The default value of browsers may be set to "text" already, so if you leave that open, nothing will happen. But in order to be on the safe site, it is better to fill it in.
Since classes are only one component of styling your documents, we will not discuss this any more but move on to using styles in general.
 

index.gif zurueck.gif