CSS Units of Measurement: Em

By: Dusty Arlia
Published on August 20, 2012
Last Updated on Tuesday, July 07, 2015 at 6:13 PM
Total Updates: 4

An em is a unit of measurement that's based on a browser's normal text size. em stands for the letter "M". "M" is the width of the widest character in the font. The em measurement is defined as the width of the current font's letter M. 1em is equal to the current font size. 2em means 2 times the size of the current font. For example, if an element is displayed with a font of 12 pt, then '2em' is 24 pt. Em is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses. Using em will give you a fluid screen layout. If you set your margins and padding using the em unit, the layout will adjust when the user changes text size.

Comments:

Ad:

Ad: