Last active
December 15, 2015 04:19
-
-
Save thisislawatts/5200432 to your computer and use it in GitHub Desktop.
Calculate a page's base em
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculate_base_em() { | |
var d = document.createElement('div'); | |
var base_height; | |
d.style.opacity = 0; | |
d.innerHTML = 'E'; | |
document.body.appendChild(d); | |
base_height = d.offsetHeight; | |
d.parentElement.removeChild(d); | |
return base_height; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment