There are many articles and questions about percentage-sized vs other-sized fonts. However, I can not find out WHAT the reference of the percent-value is supposed to be. I u
According to ALL THE SPECS DATING BACK TO 1996, percentage values on font-size
refer to the parent element's (computed) font-size.
this font size is 12px!
It's that easy.
What if the div
declares a relative font-size, like em
s, or even worse, another percentage?? See “computed” above. Whatever absolute unit the relative unit converts to.
The only question that remains is what happens when you use a percentage value on the root element, which has no parent:
html {
font-size: 62.5%; /* 62.5% of what? */
}
In that case, see the “duplicate” of this question. TLDR: percentages on the root element refer to the browser default font size, which might be different per user.
References: