Core CSS Properties & Values
Peter Coxhead
This table is meant as a quick reference to the main CSS properties and values for those who already know about Cascading Style Sheets. For more detail see http://www.w3.org/Style/.
CSS properties and constants are in lower-case letters; UPPER-CASE letters need to be replaced by CSS values.
| Text style | |||||||||||||||||||||||||||||||||||||
| color | transparent (shows background through)
| ||||||||||||||||||||||||||||||||||||
| font-weight | normal | bold | bolder | lighter | ||||||||||||||||||||||||||||||||||||
| font-family | FONTNAME | serif | sans-serif | monospace | cursive | fantasy | ||||||||||||||||||||||||||||||||||||
| font-size | NUMBER (typical units: em | % | pt) | ||||||||||||||||||||||||||||||||||||
| font-style | normal | italic | oblique | ||||||||||||||||||||||||||||||||||||
| text-decoration | none | underline | line-through | overline (may be more than one) | ||||||||||||||||||||||||||||||||||||
| Text layout | |||||||||||||||||||||||||||||||||||||
| line-height | NUMBER (typical units: em | % | pt) | ||||||||||||||||||||||||||||||||||||
| vertical-align | (Attached to inline elements, e.g. spans:) baseline | middle | sub | super | text-top | text-bottom | top | bottom (aligns the element relative to the line of text which it is in) (Attached to a table cell:) middle | top | bottom (aligns content relative to the table cell) | ||||||||||||||||||||||||||||||||||||
| text-indent | NUMBER (typical units: em | % | pt) (Indentation of first line.) | ||||||||||||||||||||||||||||||||||||
| text-align | left | right | center | justify (Applies to all inline elements within a block, including text; to align blocks see below.) | ||||||||||||||||||||||||||||||||||||
| Background | |
| background-color | COLOUR |
| Border | |
| border-top-style border-right-style border-bottom-style border-left-style border-style | none | solid | dotted | dashed | double | groove | ridge | inset | outset (Default is none, so must set to one of the others to show a border.) |
| border-top-color border-right-color border-bottom-color border-left-color border-color | COLOUR |
| border-top-width border-right-width border-bottom-width border-left-width border-width | NUMBER (typical units: em | px | pt) | thin | medium | thick |
| border-top border-right border-bottom border-left border | STYLE WIDTH COLOUR |
| Margins | |
| margin-top margin-right margin-bottom margin-left | NUMBER (typical units: em | % | pt | px) | auto (auto is useful for aligning block elements; see below.) |
| margin | TOP RIGHT BOTTOM LEFT (Watch the order, which is not consistent with other orderings of these quantities.) |
| Padding | |
| (As margins with padding replacing margin.) | |