CSS notes

Document Sample
CSS notes Powered By Docstoc
					CSS (The Basics)                             8/7/03

CSS is described in two formats as defined by W3C: CSS1 and CSS2
Go to http://jigsaw.w3.org/css-validator/ for CSS-VALIDATORS

Rules: a statement about one style aspect of one or more elements
A style sheet os a set of one or more rules that apply to an HTML doc.

Ex.      H1 { color: green}

Rule sets color of ALL first-level headings (H1)

Anatomy of a rule:

A rule consists of two parts:
    Selector- part before the curly brace
    Declaration- inclusion within curly braces
Note- {All declarations must be within curly braces}

H1 { color: green}

 |       |
 |       Declaration
Selector

Anatomy of a declaration:

A declaration consists of two parts:
    Property-part before colon
    Value-inclusion after the colon
   
H1 { color: green}

         |     |
         | Value
      Property

Grouping possibilites:        H1, H2, H3 {font-style: italic)

Now in order for you style sheet to come alive it must be “glued” to your HTML doc.

4 WAYS TO “GLUE” A STYLE SHEET WITH AN HTML DOC.
1>use style element for document-wide result
2>use style attribute for an individual element
3>Link to an external style sheet to the document using link element
4>import in a style sheet (CSS2) with @import notation