Steps to creating an External or Linked Style sheet:
- Create a new text document
- No tags/elements are included
- Input the xHTML tags /selectors - h1
- Enclose properties and values with curly brackets - h1 {color: red}
- Define the properties for that tag /selector/ class
- Separte multiple properties with a semi-colon ;
- End each tag property and value with the }
- Classes defined with a period first; IDs defined with a pound sign
- Save the text file with the extension file.css
- In the HEAD of each HTML document, place the Link tag:
<link rel="stylesheet" type="text/css" href="mystyles.css">
|
Linked / External Style Sheet Format |
h1 {font-family: serif;font-size: 16pt;
color:blue;
text-align:center}
p {font-size: 12pt; line-height:16pt}
p.two {font-size: 12pt; background:none}
a:link {font-size:14pt; font-family: Arial Black; color:red}
a:visited {font-size: 12pt; color:green; text-decoration:none}
|
Remember!
Don't confuse the colon(:) with the semi-colon (;) in the style definition. Never use quotes in embedded or external style sheet definitions
|
Importing Style Sheets into the External Style Sheet
To import a style sheet, add the following statement in the external style sheet:
@import url(main.css)
Import Style Sheet using an embed style sheet
<style type="text/css">
@import url(main.css)
@import url(story.css)
</style>
|
|
|