Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<style>
@font-face {
font-family: Ahem;
src: url(Ahem.ttf);
}
div {
font: 16px/1 Ahem;
width: 1em;
background: green;
}
</style>
<div><span>&nbsp;</span></div>
<script>
let $div = document.querySelector('div');
let $span = document.querySelector('span');
window.onload = function () {
document.fonts.ready.then(() => {
$div.style.height = $span.getBoundingClientRect().height + 'px';
});
};
</script>