W3C

Quick Reference to Cascading Style Sheets, level 1

This version is based on:
http://www.w3.org/TR/REC-CSS1
Latest version:
http://www.w3.org/TR/WD-css1.html
Author:
Steven Pemberton (Steven.Pemberton@cwi.nl)

Syntax

a b c
a is followed by b is followed by c, in that order.
a | b
either a or b must occur
a || b
either a or b or both must occur, in any order
[a b]
brackets, used for grouping
a?
a is optional
a*
a is repeated 0 or more times
a+
a is repeated 1 or more times
a{1,4}
a is repeated at least once and at most 4 times.
Juxtaposition is stronger than the double bar, and the double bar is stronger than the bar. Thus "a b | c || d e" is equivalent to "[ a b ] | [ c || [ d e]]".

Definitions

Block-level elements
an element which has a line break before and after (e.g. <H1>, <P>)
Replaced element
An element which is replaced by content pointed to from the element. E.g., <IMG>.

Properties

In each definition

5.2    Font properties

5.2.2 font-family
[[<family-name> | <generic-family>],]* [<family-name> | <generic-family>]
Initial: UA specific
<generic-family>
serif | sans-serif | cursive | fantasy | monospace
5.2.3 font-style
normal | italic | oblique
5.2.4 font-variant
normal | small-caps
5.2.5 font-weight
normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
5.2.6 font-size
<absolute-size> | <relative-size> | <length> | <percentage>
Initial: medium
Percentage values: relative to parent element's font size
<absolute-size>
xx-small | x-small | small | medium | large | x-large | xx-large
<relative-size>
larger | smaller
5.2.7 font
[ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family>
Initial: not defined for shorthand properties
Percentage values: allowed on <font-size> and <line-height>

5.3    Color and background

5.3.1 color
<color>
Initial: UA specific
5.3.2 background-color*
<color> | transparent
5.3.3 background-image*
<url> | none
5.3.4 background-repeat*
repeat | repeat-x | repeat-y | no-repeat
5.3.5 background-attachment*
scroll | fixed
5.3.6 background-position*
[<percentage> | <length>]{1,2} | [top | center | bottom] || [left | center | right]
Applies to: block-level and replaced elements
Initial: 0% 0%
Percentage values: refer to the size of the element itself
5.3.7 background*
<background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position>
Initial: not defined for shorthand properties
Percentage values: allowed on <background-position>

5.4    Text properties

5.4.1 word-spacing
normal | <length>
5.4.2 letter-spacing
normal | <length>
5.4.3 text-decoration*
none | [ underline || overline || line-through || blink ]
Inherited: no, but see clarification below
5.4.4 vertical-align*
baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage>
Applies to: inline elements
Percentage values: refer to the 'line-height' of the element itself
5.4.5 text-transform
capitalize | uppercase | lowercase | none
5.4.6 text-align
left | right | center | justify
Applies to: block-level elements
Initial: UA specific
5.4.7 text-indent
<length> | <percentage>
Applies to: block-level elements
Initial: 0
Percentage values: refer to parent element's width
5.4.8 line-height
normal | <number> | <length> | <percentage>
Percentage values: relative to the font size of the element itself

5.5    Box properties

5.5.1 margin-top*
<length> | <percentage> | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.2 margin-right*
<length> | <percentage> | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.3 margin-bottom*
<length> | <percentage> | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.4 margin-left*
<length> | <percentage> | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.5 margin*
[ <length> | <percentage> | auto ]{1,4}
Initial: not defined for shorthand properties
Percentage values: refer to parent element's width
5.5.6 padding-top*
<length> | <percentage>
Initial: 0
Percentage values: refer to parent element's width
5.5.7 padding-right*
<length> | <percentage>
Initial: 0
Percentage values: refer to parent element's width
5.5.8 padding-bottom*
<length> | <percentage>
Initial: 0
Percentage values: refer to parent element's width
5.5.9 padding-left*
<length> | <percentage>
Initial: 0
Percentage values: refer to parent element's width
5.5.10 padding*
[ <length> | <percentage> ]{1,4}
Initial: 0
Percentage values: refer to parent element's width
5.5.11 border-top-width*
thin | medium | thick | <length>
5.5.12 border-right-width*
thin | medium | thick | <length>
5.5.13 border-bottom-width*
thin | medium | thick | <length>
5.5.14 border-left-width*
thin | medium | thick | <length>
5.5.15 border-width*
[thin | medium | thick | <length>]{1,4}
Initial: not defined for shorthand properties
5.5.16 border-color*
<color>{1,4}
Initial: the value of the 'color' property
5.5.17 border-style*
none | dotted | dashed | solid | double | groove | ridge | inset | outset
5.5.18 border-top*
<border-top-width> || <border-style> || <color>
Initial: not defined for shorthand properties
5.5.19 border-right*
<border-right-width> || <border-style> || <color>
Initial: not defined for shorthand properties
5.5.20 border-bottom*
<border-bottom-width> || <border-style> || <color>
Initial: not defined for shorthand properties
5.5.21 border-left*
<border-left-width> || <border-style> || <color>
Initial: not defined for shorthand properties
5.5.22 border*
<border-width> || <border-style> || <color>
Initial: not defined for shorthand properties
5.5.23 width*
<length> | <percentage> | auto
Applies to: block-level and replaced elements
Percentage values: refer to parent element's width
5.5.24 height*
<length> | auto
Applies to: block-level and replaced elements
5.5.25 float*
left | right | none
5.5.26 clear*
none | left | right | both

5.6    Classification

5.6.1 display*
block | inline | list-item | none
5.6.2 white-space
normal | pre | nowrap
Applies to: block-level elements
5.6.3 list-style-type
disc | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none
Applies to: elements with 'display' value 'list-item'
5.6.4 list-style-image
<url> | none
Applies to: elements with 'display' value 'list-item'
5.6.5 list-style-position
inside | outside
Applies to: elements with 'display' value 'list-item'
5.6.6 list-style
<list-style-type> || <list-style-position> || <url>
Applies to: elements with 'display' value 'list-item'
Initial: not defined for shorthand properties

6.1    Length units

<length>
[+|-]?<number><unit>
<number>
<digit>+[.<digit>*]?
<unit>
<absolute-unit> | <relative-unit>
<absolute-unit>
mm | cm | in | pt | pc
<relative-unit>
em | ex | px

6.2    Percentage units

<percentage>
<number>%

6.3    Color units

<color>
<color-name> | <rgb>
<color-name>
aqua | black | blue | fuchsia | gray | green | lime | maroon | navy | olive | purple | red | silver | teal | white | yellow
<rgb>
#<hex><hex><hex> |
#<hex><hex><hex><hex><hex><hex> |
rgb(<number>, <number>, <number>) |
rgb(<percentage> <percentage>, <percentage>)

6.4    URL

<url>
url(<text>)