The following table shows the value types, available values, samples, and some general comments regarding the use of property values within CSS.
Note |
Not all value types are represented here, only the ones used in this book. There are additional types available for aural style sheets and counters. You can find information on these value types at www.w3.org/TR/REC-CSS2/syndata.html#values. |
Value Type |
Available Values |
Example(s) |
Notes |
---|---|---|---|
Integers and Real Numbers |
0-9 |
line-height: 1.3; |
Line-height is the only property that accepts a real number; z-index is the only property to accept integers. |
Lengths: |
Height of M (em) |
0.95em |
Relative unit lengths are scaled according to the size of the parent element. |
Lengths: |
Inches (in) |
1in |
Absolute length units do not scale. |
Lengths: |
xx-small, x-small, small, smaller, medium, large, larger, x-large, xx-large |
font-size: large |
Keyword measurements do not necessarily scale. These keywords apply only to font-size. |
Percentages |
% |
width: 100% | |
URL + URN = |
URI url() |
url(/images/012/logo.gif) |
Single or double quotes maybe used inside the parentheses. You must escape commas, parentheses, whitespace characters, and single and double quotes which appear in a URI with a backslash. |
Colors: |
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow |
color: orange; |
Most named colors are not part of the web-safe palette. |
Colors: |
#hexvalue |
color: #FFFFFF | |
Colors: |
#hexvalue |
color: #FFF |
Only available for paired values. All web-safe colors can be written in shorthand. |
Colors: |
#hexvalue |
color: (255, 255, 255) | |
Colors: |
% |
color: (80%, 30%, 20%) |