What I want to do
I would like to measure the 1ex in px.
What I have learned
- 1ex is a relative unit -- equal to the height of lower case "x" of the font in use:
An instructive image describing the situation:

link to CSS spec:
http://www.w3.org/TR/css3-values/#font-relative-lengths
window.getComputedStyle('foo',null).heightorjQuery('#foo').height()does not help -- because they return the height of its bounding box. e.g.<div id="upper"> X </div> <div id="lower"> x </div> <script> var upper = $('#upper').height(); var lower = $('#lower').height(); console.log(upper === lower); </script>The last line gives
true.Related pages, but not fully informative to me:
Any information is appreciated!
EDIT:
Some people suggests that this is a dupe of
but there are NO ACTUAL answers: The first answer explains only relativity of 1ex and the second one is even wrong -- document.getElementById('upper').style.height returns "" // empty char.