|
Linking stylesheets on your pages is regarded as the best way to apply
formatting to all your pages, with just a single line in the head tag.
To create an external file just open notepad or a text editor, type
in the declarations and save it as styles.css (or a filename of your
choice). With an external file you dont need to include the <style>..</style>
opening and closing tags, as the link to the stylesheet will instruct
the browser that it is a list of stylesheet declarations. Link to external StyleSheet: <head> <link rel="stylesheet" type="text/css" href="styles.css"> External stylesheet file content: HTML TAG {
attribute: value;
attribute: value
}
.classname {
attribute: value;
attribute: value
}
#id {
attribute: value;
attribute: value
}
The illustration above shows how a css file is structured. As you can see, no HTML tags are neededas such - just the element name. The semi-colon indicates the end of a declaration and also that there are more declarations to come. At the end of a given block of code, the last declaration will not have a semi-colon. The way a stylesheet is laid out is: The html element name then an opening
bracket, then the attribute followed by a colon, and the value of that attribute,
followed by a semi-colon. Go to: Next page >>> | Home | Top Remember, if you get stuck or need to ask any questions, register with the forums and tell us about it! |
|