Loading...
 

CSS Units of Measure

Throughout this CSS reference guide, abstract values (notably values involving units of measure) appear between angle brackets:. They should be replaced by actual values as indicated in the key below.

Length Units

 indicates a number followed by a unit of measure:24px.

The number can be an integer or a decimal fraction, and can be preceded by + or -.

Units can be absolute or relative:

Absolute: mm, cm, in, pt, pc (millimeters, centimeters, inches, points, picas)

Relative: em, ex, px (the element’s font height, the element’s x-height, pixels)

Font size may be defined in points, pixels, inches, or centimeters (pt, px, in, cm) or as a percentage.

 can be:xx-small, x-small, small, medium, large, x-large, xx-large.

 can be:larger, smaller.

Percentage Units

 indicates a number followed by a % sign:50%.

In the text-indent, margin, padding, and width properties, percentage values are relative to the width of the parent element.

In the font-size property, percentage values are relative to the font size of the parent element.

In  values, percentages can be used to express RGB values.

Color Units

 can represent either  or  values, as defined below:

 can be: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, yellow

 can be:

#

rgb()

rgb(,,)

 represents a hexidecimal value,  a decimal value, and  a percentage.