Units of Measurement

Contact Us or call 1-877-932-8228
Units of Measurement

Units of Measurement

CSS allows you to specify font size, border size, margins, padding, etc. using many different units of measurement. The table below shows the units available.

Name Unit Example
Pixels px margin-top: 10px;
Pixel is the measurement unit most often used for designing web pages is pixels. A pixel is not an absolute measurement like, for example, an inch or a point. The actual size of a pixel depends on the resolution and size of a user's monitor. Consider an image that is 900 pixels wide. If the monitor resolution is set to 800 by 600 pixels, then the image will not fit on the screen. However, if the monitor resolution on the same computer is set to 1024 by 768 pixels, the image will fit with room to spare.
Points pt font-size: 12pt;
Points should be reserved for print. There are 72 points in an inch.
Inches in padding-top: .5in;
Although inches are one of the most common units of measurement in life, they should be avoided in web design.
Centimeters cm top: 5cm;
Although centimeters are one of the most common units of measurement in life, they should be avoided in web design.
Millimeters mm left: 45mm;
Although millimeters are one of the most common units of measurement in life, they should be avoided in web design.
Picas pc bottom: 12pc;
Picas should be reserved for print. There are 6 picas in an inch.
Ems em font-size: 1.5em;
An em (or Mutt) is a relative unit that refers to the size of the letter "M" in a font. Because em is a relative rather than absolute measurement, it is often used in web design, especially for font sizes.
Exs ex font-size: 1.5ex;
The "x-height" is the height of font's lowercase "x". Exs are used to set the size of content based on the size of the surrounding font.
Percentage % width: 80%;
The percentage is based on the default size had no value been specified.
Next