| Home | Next | Cascading Style Sheets |
A CSS rule is made up of a selector, and declarations, which are pairs of properties and values.
selector {property: value;
property: value;
property: value, value, value;
}
The scope of the CSS rule (that is, which HTML elements should follow this rule) is set by the selector.
You can use HTML, class and ID selectors.
In the style sheet:
H3 {color: red;}
In the document:
<h3>Minor heading</h3>
In the style sheet:
.funstuff {font-family: 'comic sans ms';}
P.funstuff {font-family: 'comic sans ms';}
In the document:
<p class="funstuff"> Here is some fun stuff... </p>
In the style sheet:
#area1 {margin-left: 10%; color: pink;}
In the document:
<div id="area1"> Bleeble blabble blooble blum... </div>
Each ID may only be used once in a document.
| Home | Next | Cascading Style Sheets |