blob: 23d8e0c244baad88fc43abc5ce3d9c9ce0a837ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<!DOCTYPE html>
<style>
@font-face {
font-family: Ahem;
src: url(Ahem.ttf);
}
div {
font: 16px/1 Ahem;
width: 1em;
background: green;
}
</style>
<div><span></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>
|