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
([email protected])
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.
,
)
- Replaced element
-
An element which is replaced by content pointed to from the
element. E.g.,
.
Properties
In each definition
- the default value is shown in bold, or given separately
- values apply to all elements unless otherwise stated
- properties are inherited unless the property name is marked with a star "*".
5.2.2 font-family
[[ | ],]* [ | ]
Initial: UA specific
-
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
| | |
Initial: medium
Percentage values: relative to parent element's font size
-
xx-small | x-small | small | medium | large | x-large | xx-large
-
larger | smaller
5.2.7 font
[ || || ]? [ / ]?
Initial: not defined for shorthand properties
Percentage values: allowed on and
5.3.1 color
Initial: UA specific
5.3.2 background-color*
| transparent
5.3.3 background-image*
| 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*
[ | ]{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*
|| || || ||
Initial: not defined for shorthand properties
Percentage values: allowed on
5.4.1 word-spacing
normal |
5.4.2 letter-spacing
normal |
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 |
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
|
Applies to: block-level elements
Initial: 0
Percentage values: refer to parent element's width
5.4.8 line-height
normal | | |
Percentage values: relative to the font size of the element itself
5.5.1 margin-top*
| | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.2 margin-right*
| | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.3 margin-bottom*
| | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.4 margin-left*
| | auto
Initial: 0
Percentage values: refer to parent element's width
5.5.5 margin*
[ | | auto ]{1,4}
Initial: not defined for shorthand properties
Percentage values: refer to parent element's width
5.5.6 padding-top*
|
Initial: 0
Percentage values: refer to parent element's width
5.5.7 padding-right*
|
Initial: 0
Percentage values: refer to parent element's width
5.5.8 padding-bottom*
|
Initial: 0
Percentage values: refer to parent element's width
5.5.9 padding-left*
|
Initial: 0
Percentage values: refer to parent element's width
5.5.10 padding*
[ | ]{1,4}
Initial: 0
Percentage values: refer to parent element's width
5.5.11 border-top-width*
thin | medium | thick |
5.5.12 border-right-width*
thin | medium | thick |
5.5.13 border-bottom-width*
thin | medium | thick |
5.5.14 border-left-width*
thin | medium | thick |
5.5.15 border-width*
[thin | medium | thick | ]{1,4}
Initial: not defined for shorthand properties
5.5.16 border-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*
|| ||
Initial: not defined for shorthand properties
5.5.19 border-right*
|| ||
Initial: not defined for shorthand properties
5.5.20 border-bottom*
|| ||
Initial: not defined for shorthand properties
5.5.21 border-left*
|| ||
Initial: not defined for shorthand properties
5.5.22 border*
|| ||
Initial: not defined for shorthand properties
5.5.23 width*
| | auto
Applies to: block-level and replaced elements
Percentage values: refer to parent element's width
5.5.24 height*
| 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.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
| 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
|| ||
Applies to: elements with 'display' value 'list-item'
Initial: not defined for shorthand properties
[+|-]?
|
mm | cm | in | pt | pc
em | ex | px
%
|
aqua | black | blue | fuchsia | gray | green | lime | maroon | navy |
olive | purple | red | silver | teal | white | yellow
# |
# |
rgb(, , ) |
rgb( , )
url()