What is the context of em?

It’s equal to the computed value of the ‘font-size’ property of the element on which it is used. Inheritance runs down the document tree.

To answer your question, it would be 0.5 times the 2em, which in turn would be 2 times whatever the h1’s parent’s computed font-size is. phew.

It’s also important to note that if you use em on other CSS properties, for example, width or height, the result will be calculated from the computed font-size of whatever element you apply the width or height to, etc…

The following article describes the use and context of the em unit rather well in my opinion, along with some other reading material and resources… rem units may interest you somewhat also.

  1. http://www.impressivewebs.com/understanding-em-units-css/
  2. http://snook.ca/archives/html_and_css/font-size-with-rem
  3. http://caniuse.com/rem

You may also like to check out this fiddle to see how it acts a little clearer:

http://jsfiddle.net/HpJjt/3/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)