| Property name | Values | Element |
|---|---|---|
| font-family | <font name> | all |
| font-style | normal | italic | oblique | all |
| font-weight | normal | bold | 100-900 | all |
| font-size | <absolute> | <relative> |<length> | <percentage> | all |
| font | <font-family><font-style> <font-weight><font-size> | all |
| Property name | Values | Element |
|---|---|---|
| line-height | normal | <number> | <length> | <percentage> | all |
| text-decoration | none | underline | line-through | blink | all |
| text-align | left | right | center | justify | block |
| text-indent | <length> | <percentage> | all |
| Property name | Values | Element |
|---|---|---|
| list-style-type | none | disc | circle | square | decimal | lower-alpha | upper-alpha | lower-roman | upper-roman | <li> tags |
| Property name | Values | Element |
|---|---|---|
| color | <color> | all |
| background-color | transparent | <color> | all |
| background-image | none | <url> | all |
| background-repeat | repeat | repeat-x | repeat-y | no-repeat | all |
| background | <background-color> |<background-image> |<background-repeat> | all |
| Property name | Values | Element |
|---|---|---|
| margin-top margin-bottom margin-right margin-left |
<length> |<percentage> | auto | all |
| margin | <length> |<percentage> | auto | all |
| padding-top padding-bottom padding-left padding-right | <length> |<percentage> | all |
| padding | <length> |<percentage> | all |
| border-color | <colour> | all |
| border-style | none | dotted | dashed | solid | double | groove | ridge |inset | outset | all |
| border-top border-bottom border-left border-right | medium | thin | thick | all |
| border-width | medium | thin | thick | all |
| border | <border-width> <border-style> <colour> | all |
| width | <length> |<percentage> | auto | all |
| height | <length> | auto | all |
| float | left | right | none | all |
| clear | left | right | both | all |
| Property name | Values | Element |
|---|---|---|
| position | static | absolute | relative | all |
| left | <length> |<percentage> | auto | all |
| top | <length> |<percentage> | auto | all |
| visibility | visible | hidden | all |
| z-index | <number> | auto | all |
| syntax: | font-family: family-name [,family-name, ..., family-name]; |
|---|---|
| values: | family-name can be any font family name(Times,Helvectica etc.) or a generic-family name. generic-families:
|
| default value: | Determined by browser |
| applies to: | All elements |
Font-family can be a specific font family name or a generic font family.
Multiple family-names can be specified as a comma separated list.
Specifying a generic font family is preferable to specifying a particular font
family because not all fonts are available on any one computer unless you know
what fonts are available on the user's browser.
P { font-family: Utopia,Times,"New Century Schoolbook",serif;}
The specific families are listed first: Utopia,
Times and
New Century Schoolbook
The first available font family from the list will be used. The last family in
the list should be a generic family name in case the first choices are not
available.
In this example, if none of the specific fonts are available then
serif will be used.
Note: Any font name containing whitespace must be quoted with either single or double quotes.
| syntax: | font-style: value |
|---|---|
| values: | normal |
italic |
oblique |
| default value: | normal |
| applies to: | All elements |
.slanted { font-style: oblique;}
DIV { font-style: normal;}
SPAN { font-style: italic;}
| syntax: | font-weight: value |
|---|---|
| values: | normal |
bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
| default value: | normal |
| applies to: | All elements |
| 100-300 | will be set to the next lighter weight (if there is is a lighter weight). |
| 400-500 | may be interchanged with each other. |
| 600-900 | will be set to the next darker weight(if there is is a darker weight). |
P { font-weight: 500;}
P.special { font-weight: bold;}
SPAN.normal { font-weight: normal;}
| syntax: | font-size: absolute | relative | length | percentage; |
|---|---|
| values: |
|
| default value: | medium |
| Applies to: | All elements |
H1 { font-size: x-large;}
H2 { font-size: large;}
P { font-size: 12pt;}
LI { font-size: 70%;}
STRONG { font-size: larger;}
| syntax: | font:
<font-style>
<font-weight>
<font-size> [/<line-height>]
<font-family> |
|---|---|
| Applies to: | All elements |
.special { font:italic bold 12pt/14pt "Times New Roman", serif;}
Specifies a 12 pt bold and italic serif font with a line height of 14 pts.
| syntax: | text-decoration: none | underline | overline | line-through | blink |
|---|---|
| values: |
|
| default value: | none |
| applies to: | All elements |
.strikeOut { text-decoration: line-through; }
// turn off underlining of hypertext links
A:link, A:visited, A:active { text-decoration: none; }
| syntax: | text-transform: none | capitalize | uppercase | lowercase |
|---|---|
| values: | none |
capitalize |
uppercase |
lowercase
|
| default value: | none |
| applies to: | All elements |
H1.caps { text-transform: uppercase;}
LI.proper { text-transform: capitalize;}
| syntax: | text-align: left | right | center | justify |
|---|---|
| values: | left | right | center | justify |
| default value: | undefined |
| applies to: | Block-level elements |
H3 { text-align: center }
P.justified { text-align: justify }
| syntax: | text-indent:<length> | <percentage> |
|---|---|
| values: | <length> | <percentage> |
| default value: | 0 |
| applies to: | Block-level elements |
The text-indent property specifies the level of indentation
that the first line of the block-element will use.
Examples:
P { text-indent: 5em }
| syntax: | line-height: normal | <number> | <length> | <percentage> |
|---|---|
| values: | normal | <number> | <length> | <percentage> |
| default value: | normal |
| applies to: | All elements |
The line-height property specifies the spacing between baselines of
text in the element.
If the value is a number, the line height is element's font size multiplied
by the number.
Percentage is relative to the element's font size.
The line-height can also be specified in the font
property immediately following the font size.
Examples:
P.double { line-height: 200%;}
LI.double { line-height: 2;}
LI.example { line-height: 150%;}
| syntax: | vertical-align: baseline | sub | super | top | text-top | middle | bottom | text-bottom |<percentage> |
|---|---|
| values: |
|
| default value: | baseline |
| applies to: | Inline elements |
.sub { vertical-align: sub;}
IMG.middle { vertical-align: middle;}
IMG.bottom { vertical-align: bottom;}
| syntax: | white-space: normal | pre | nowrap |
|---|---|
| values: |
|
| default value: | normal |
| applies to: | Block-level elements |
| syntax: | list-style-type: none | disc | circle | square | decimal |
lower-roman | upper-roman | lower-alpha | upper-alpha |
|---|---|
| values: |
|
| default value: | disc |
| applies to: | list items<LI> and lists<UL><OL> |
LI.square { list-style-type: square;}
UL.none { list-style-type: none;}
OL { list-style-type: decimal;}
OL OL { list-style-type: lower-alpha;}
OL OL OL { list-style-type: lower-roman;}
| syntax: | list-style-image: none | <url> |
|---|---|
| values: | <url> | none |
| default value: | none |
| applies to: | list items<LI> and lists<UL><OL> |
UL.globe { list-style-image: url(greenGlobe.gif);}
UL LI { list-style-image: url(cherry.jpg);}
| syntax: | position: static | absolute | relative |
|---|---|
| values: |
|
| default value: | static |
| applies to: | All elements |
#layer1 { position: absolute;}
#note { position: absolute;}
DIV.origin { position: absolute; top:0; left:0;}
| syntax: | top: <length> | <percentage> | auto |
|---|---|
| values: |
|
| default value: | auto |
| applies to: | All elements |
#layer1 { position: absolute; top: 101px;}
#note { position: relative; top: -12mm;}
DIV.origin { position: absolute; top:0; left:0;}
| syntax: | left: <length> | <percentage> | auto |
|---|---|
| values: |
|
| default value: | auto |
| applies to: | All elements |
#layer1 { position: absolute; top: 200px; left:300px;}
#note { position: relative; top: -12mm; left:50mm;}
DIV.origin { position: absolute; top:10; left:auto;}
| syntax: | visibility: visible | hidden |
|---|---|
| values: |
|
| default value: | visible |
| applies to: | All elements |
#layer1 { position: absolute;
top: 200px; left:300px;
visiblity: hidden;
}
#note { position: relative;
top: -400%; left:50%;
visiblity: visible;
}
| syntax: | z-index: <number> | auto |
|---|---|
| values: |
|
| default value: | visible |
| applies to: | All elements |
#layer1 { position: absolute;
top: 200px; left:300px;
z-index: 10;
}
#note { position: relative;
top: -400%; left:50%;
z-index: 20;
}
| syntax: |
margin-top: <length> | <percentage> | auto margin-bottom: <length> | <percentage> | auto margin-left: <length> | <percentage> | auto margin-right: <length> | <percentage> | auto margin: <value> [<value>] [<value>] [<value>] |
|---|---|
| values: |
|
| default value: | 0 |
| applies to: | All elements |
#note1 { margin: 24px;}
#note2 { margin: 2em 4em;}
#note3 { margin: 10% 4em 2px;}
#note4 { margin: 10px 18px 10em 20%;}
| syntax: |
padding-top: <length> | <percentage> padding-bottom: <length> | <percentage> padding-left: <length> | <percentage> padding-right: <length> | <percentage> padding: <value> [<value>] [<value>] [<value>] |
|---|---|
| values: |
|
| default value: | 0 |
| applies to: | All elements |
#note1 { padding: 24px;}
#note2 { padding: 2em 4em;}
#note3 { padding: 10% 4em 2px;}
#note4 { padding: 10px 18px 10em 20%;}
| syntax: |
border-top: <border-top-width> | <border-style> | <color> border-bottom: <border-bottom-width> | <border-style> | <color> border-left: <border-left-width> | <border-style> | <color> border-right: <border-right-width> | <border-style> | <color> border:<border-width> | <border-style> | <color> |
|---|---|
| values: |
|
| default value: | not defined |
| applies to: | All elements |
.boxEG1 { border-left: thin solid black;
border-top: thick dashed blue;
border:-right 2px solid #fcc;
border-bottom: 10px double red;
}
| syntax: |
border-style: dotted | dashed | solid | double | groove | ridge | inset | outset |none; border-style: <value> [<value>] [<value>] [<value>] |
|---|---|
| values: |
|
| default value: | 0 |
| applies to: | All elements |
#note1 { border-style: solid;}
#note2 { border-style: dotted solid;}
#note3 { border-style: dotted solid groove;}
#note4 { border-style: solid solid none none;}
| syntax: |
border-color: <color> [<color>] [<color>] [<color>]; |
|---|---|
| values: |
|
| default value: | element's parent container color |
| applies to: | All elements |
#note1 { border-color: solid;}
#note2 { border-color: red;}
#note3 { border-color: red blue #f66;}
#note4 { border-color: blue green black red;}
| syntax: |
border-width-top: thin | medium | thick | <length>; border-width-bottom: thin | medium | thick | <length>; border-width-left: thin | medium | thick | <length>; border-width-right: thin | medium | thick | <length>; border-width: <value> [<value>] [<value>] [<value>]; |
|---|---|
| values: |
|
| default value: | medium |
| applies to: | All elements |
#note1 { border-width: 24px;}
#note2 { border-width: thin 4em;}
#note3 { border-width: thick none medium;}
#note4 { border-width: 0;}
© m.sutherland 2001