External style sheets
An external style sheet may be linked to an HTML document through HTML's
LINK element:
<HTML>
<HEAD>
<TITLE>External Style sheets</TITLE>
<LINK REL=stylesheet HREF="top.CSS"
TYPE="text/css">
</HEAD>
<BODY>
<H2>koodesign</H2>
<P>Style sheets can save a lot of work!</P>
</BODY>
</HTML>
Click here to see the
result.
Things to remember:
1) The REL attribute is used to define the relationship
between the linked file and the HTML document.
2) External style sheets should not contain any HTML tags like <HEAD>
or <STYLE>. The style sheet should consist of style rules or statement.
3) External style sheets are in a separate text file with .css extension.
ie: The external style sheets in our example are in a file called top.css
and it contains the following statement:
p { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;
font-style: italic}
td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt}
H2 { font-family: Verdana, Arial, Helvetica, sans-serif ; color: #FF0000}
body { background-color: #FFCC66}
You could use relative or absolute URLS with the HREF attribute.
|