Try replacing the use of inherit
with font-size: 1em
.
The issue with using inherit
in IE has been noted. While it appeared fine in IE9, I encountered problems where both testEl.currentStyle.fontSize
and $(testEl).css('font-size')
returned 12px.
It is suggested that for IE8, specifying a !DOCTYPE may be necessary to employ font-size: inherit, although it should function properly in IE9 (http://www.w3schools.com/cssref/pr_font_font-size.asp). Strangely, testEl.currentStyle.fontSize
and $(testEl).css('font-size')
do not show the correct values in IE9.
By setting the font-size to 1em, you are adjusting it to 100% of the parent font-size, yielding 20px in this scenario. As explained on http://www.w3schools.com/cssref/css_units.asp:
1em is equivalent to the existing font size. 2em denotes twice the size of the current font. For example, if an element is displayed with a font of 12 pt, '2em' corresponds to 24 pt. The 'em' unit in CSS is beneficial as it can automatically adjust to the reader's chosen font size
Consequently, both computedStyle.fontSize
and $(testEl).css('font-size')
ought to show 20px.
I trust this information proves helpful!