CoderZone Sandbox: CSS: Measurement Units
CSS dimensions can be expressed in a wide variety of ways: in pixels, percent, centimeters, inches, millimeters, points, picas, 'ex's or 'em's. The most typical unit used is the pixel (px), but for elastic designs the 'em' is often preferred. The table below summarizes the available units for use in CSS.

Unit Name Unit Type Unit Description
% Relative "percentage", assigns a percentage of the container's dimension
cm Absolute "centimeter", referenced to the metric system, equal to one hundredth of a meter
em Relative "em", one 'em' is always equal to the font size in the selected container (div or span). Two 'em' is equal to twice the font size in the selected container.
ex Relative "ex", the x-height is the height of the letter "x" in the current font.
in Absolute "inch", referenced to the standard US inch (Imperial units, equal to 2.54 centimeters)
mm Absolute "millimeter", referenced to the metric system, equal to one thousandth of a meter
pc Absolute "pica", one pica equals 12 points.
pt Absolute "point", one point equals 1/72 inch. Points are most frequently used as measurements for printed materials.
px Relative "pixels", defined as a single dot element on the computer screen, regardless of resolution.

Edit code in the area below, then click the "Test It" button:
Result of your code:
   Back to Sandbox 
© | users online: 10