Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Length units reference

This section defines the supported length units for cascading style sheet text, layout, and positioning properties.

Measurements and positions in cascading style sheet properties are indicated in length units. Microsoft Internet Explorer supports two types of length units, relative and absolute:

  • Relative   A length relative to another property. Relative length units scale better from one output device to another (such as from a monitor to a printer) and in comparison to other page elements.

  • Absolute   An exact measurement, such as inches or centimeters. Absolute length units are useful when the physical properties of the output device are known.

Relative length units

em

The computed font-size

ex

The height of a lowercase "x"

px

Pixels, relative to the viewing device

%

Percentage

Absolute length units

in

Inches (1 inch = 2.54 centimeters)

cm

Centimeters

mm

Millimeters

pt

Points (1 point = 1/72 inches)

pc

Picas (1 pica = 12 points)

The em unit is relative to the computed value of the font-size property of the element. When em occurs in the value of the font-size property itself, it refers to the font size of the parent element. It can be used in both vertical and horizontal measurements.

Pixel units are relative to the resolution of the viewing device; for example, a 600 dots per inch (dpi) laser printer requires more dots to achieve the same pixel density as a computer monitor.

Percentage values are always relative to another value (for example, a length). Attributes that allow percentages also define the property to which the percentage refers. For example, the width of a table cell can be specified as a percentage of the entire table.

Standards compliance

Length values must specify a unit type identifier. When you use the !DOCTYPE declaration to specify standards-compliant mode, Internet Explorer 6 and later versions ignore style sheet declarations that do not comply with Cascading Style Sheets (CSS), Level 1 (CSS1).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.