Values
Value of css property can be represent by explicit numeric value, predefined names like inline-block, previously declared variable or via special functions.
Absolute length units
Absolute length units are not recommended for use on screen, because screen sizes vary so much.
units | explanation | example |
---|---|---|
px | pixels (1px = 1/96th of 1in) |
|
pt | points (1pt = 1/72 of 1in) | |
pc | picas (1pc = 12 pt) | |
in | inches (1in = 96px = 2.54cm) | |
cm | centimeters | |
mm | millimeters |
Relative length units
Relative units uses for adaptive pages.
units | explanation | example |
---|---|---|
em | font-size of the element |
|
rem | relative to font size of the root element. Use html or
:root selectors for change font size. Default value of size is 16 pixels, in this case:
| |
vw | 1% of the width of the viewport | |
vh | 1% of the height of the viewport | |
vmin | 1% of viewport's smaller dimension | |
vmax | 1% of viewport's larger dimension | |
% | 1% of the parent element |
Color values
Color value can be assigned by name, hex number, or via special functions.
explanation | example | |
---|---|---|
#RRGGBB | RR,GG,BB are hexadecimal numbers |
|
functions | Some css functions like rgb (r,g,b) | |
predefined name | Names like
|