So, link and link give hints about how fonts are implementation dependent. This question is very especific to font-size in the following case:
font-size: 50px; will take aditional space to render (60px in my case)
div {
height: 50px;
font-size: 50px;
background: green;
}
span {
background: red;
}
.lineheight {
line-height: 50px;
}
<p>Green is 50px, Red is not</p>
<div><span>fg</span></div>
<p>You can still see the overflow without span:</p>
<div>jAaMgÁ</div>
<p>line-height does not solve the issue (just makes it prettier)</p>
<div class="lineheight"><span>jAaMgÁ</span></div>
- What i expect to happen is: ascender and descender inside em square
- What i get is: descender is draw outside the em square.
- From the documentation link: "The font size corresponds to the em square"
- From this reference the em square should include both descender and ascender:
So why is the browser doing something else? I tried Firefox and Chrome, and both seem consistent with this (miss?)behaviour... did the specification change? if so, what is the appropiate way to tell the browser the font height including descender and ascender?
(width can be ignored, and you are free to use up to CSS4, but CSS3 is appreciated)