CSS1 Quick Reference
Examples
@import "http://www.w3.org/pub/WWW/def-style.css";
@import "../gray.css";
/* this is a comment */
H1 EM, P:first-letter, OL LI.special {
color: yellow;
background: red
}
#pqr321 {
font-size: 8pt;
font-style: normal
}
Pseudo-classes
:link, :visited, :active.
Pseudo-elements
:first-line, :first-letter.
Properties
[*] = property is inherited
- background: transparent | [<color> || <url> || <repeat> || <scroll> || <position>]
- background-color: transparent | <color>
- background-image: none | <url>
- background-repeat: repeat | repeat-x | repeat-y | no-repeat
- background-attachment: scroll | fixed
- background-position: <position>
<repeat> = repeat | repeat-x | repeat-y | no-repeat
<scroll> = fixed | scroll
<position> = [<percentage> | <length>]{1,2} | [top | center | bottom] || [left | center | right]
- [*] word-spacing: normal | <length>
- [*] letter-spacing: normal | <length>
- [*] text-decoration: none | [underline || overline || line-through || blink]
- [*] vertical-align: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage>
- [*] text-transform: capitalize | uppercase | lowercase | none
- [*] text-align: left | right | center | justify
- [*] text-indent: <length> | <percentage>
- margin-left, margin-right, margin-top, margin-bottom: <length> | <percentage> | auto
- margin: [<length> | <percentage> | auto]{1,4}
- padding-left, padding-right, padding-top, padding-bottom: <length> | <percentage>
- padding: [<length> | <percentage> | auto]{1,4}
- width: <length> | <percentage> | auto
- height: <length> | auto
- float: left | right | none
- clear: none | left | right | both
- display: block | inline | list-item | none
- [*] white-space: normal | pre | nowrap
- [*] list-style: <keyword> || <position> || <url>
- [*] list-style-type: <keyword>
- [*] list-style-image: <url>
- [*] list-style-position: <position>
<keyword> = disk | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none
<position> = inside | outside
Units
pt (=1/72in), in (=2.54cm), pc(=12pt), mm, cm, px, em, ex.
Colors
<color> = aqua | black | blue | fuchsia | gray | green | lime | maroon | navy | olive | purple | red | silver | teal | white | yellow | <hex-color> | <rgb-color>
<hex-color> = #RGB | #RRGGBB (where R, G, B taken from 0123456789ABCDEF)
<rgb-color> = rgb(R, G, B) | rgb(r%, g%, b%) (useful range for R, G, and B is 0-255)
URL Values
url(<URL>)