2009 Apr 28
CSS Rules |
CSS Comments |
CSS Keywords |
Cascade Rules |
Element Types |
Element Levels |
Font Properties |
Forms | Generated Properties |
Selector Syntax |
Tips |
<hr> Properties |
List Properties |
Outline Properties |
Table Properties |
Text Properties |
Visual Formatting |
All Properties |
@ Directives |
Aural Units |
Length Units |
Named Colors |
Interface Styles |
Aural Media |
Print Media |
Projection Media |
Non Standard Properties |
|
Dropped in CSS2.1 |
External Links |
Note: Relative URLs in a style sheet are relative to the style sheet not the document.
Notation for property values:
Each CSS rule consists of a Selector followed by a Declaration block:
Selector | Declaration Block |
A Declaration block consists of curly braces containing a sequence of
Declarations.
A Declaration is a property followed by a colon,
followed by a value, followed by a semi-colon.
h1 { color: blue; text-align: center; }
A value is one or more space separated keywords appropriate to the property. The one exception is the font property where a forward slash can separate specific keywords, e.g.:
p { font: large/256% sans-serif; }
There can optionally be other spaces in the rule. If an incorrect (i.e. unknown) property or value is used, then the declatation is ignored.
CSS comments are like C/C++ comments they start with /* and end with */ and can span multiple lines.
This allows HTML style comments, <!-- ... -->, to surround CSS rules in case an old browser does not support the CSS related elements.
Keywords that can apply depend on the element and attribute. The same keyword may have different meaning for different elements or attributes.
inherit | Since CSS2.1 makes the property same as parent (this is default). Assigned styles usually override inherited styles. |
none | Not the same as 0 |
normal | e.g. different for letter-spacing or font-style |
See Cascade Rules. Projection media are like print media in that the display size is fixed. At this time only the Opera agent supports this.