What is height in em?

The meaning of "em" has changed over the years. Not all fonts have the letter "M" in them (for example, Chinese), but all fonts have a height. The term has therefore come to mean the height of the font – not the width of the letter "M."

Let's look at a simple example where we use the em unit to set font sizes:

<html>
  <style>
    h1 { font-size: 2em }
  </style>
  <body>
    <h1>Movies</h1>
  </body>
</html>

When used to specify font sizes, the em unit refers to the font size of the parent element. So, in the previous example, the font size of the h1 element is set to be twice the font size of the body element. To find what the font size of the h1 element will be, we need to know the font size of body. Because this isn't specified in the style sheet, the browser must find it from somewhere else – a good place to look is in the user's preferences. So, if the user sets the normal font size to 10 points, the size of the h1 element is 20 points. This makes document headlines stand out relative to the surrounding text. Therefore: Always use ems to set font sizes!

More Info


1em is equal to the current font size. 2em means 2 times the size of the current font. E.g., if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses.

more here


1em is equal to the current font size.

2em means 2 times the size of the current font.

E.g., if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses

Here's a link to other CSS units:

http://www.w3schools.com/cssref/css_units.asp

Tags:

Css

Size

Height