Div's height is not correct, if I use the font imported above. But as an example, Verdana is ok. This is one of my system fonts.
var dim = document.querySelector(".dim");
var box = document.querySelector(".box");
var clientHeight = box.clientHeight;
var offsetHeight = box.offsetHeight;
dim.innerHTML = "clientHeight: " + clientHeight + ", " + "offsetHeight: " + offsetHeight;
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');
* {
margin : 0px;
padding : 0px;
box-sizing : border-box;
}
.box {
position : absolute;
left : 100px;
top : 10px;
border : 1px solid #000;
width : 200px;
padding : 10px;
background : green;
text-align : center;
font-size : 12px;
font-family : Verdana;
/*font-family : 'Open Sans', sans-serif;*/
/*font-family : Anton;*/
}
.dim {
position : absolute;
left : 350px;
top : 10px;
border : 1px solid #222;
width : 300px;
height : 40px;
padding : 10px;
background : lightblue;
text-align : center;
opacity : 1;
}
<div class="box">
1 Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci voluptate exercitationem alias...
</div>
<div class="dim"></div>
I use it in a marquee. Thanks for any effort to help. :)