i'm working on a website where the client wants some titles at 0.875em.
I checked online, and the base em unit should be 16px for modern browsers. Well, if I set the text-size to 1em in chrome developper, it's set at 12px instead of 16px.
Tried setting body{font-size:100%}
at the beginning. No luck.
How do I put it back at 16px base?
Thanks!
That is because Chrome's default font-size is 12px. You should set the body and/or html element's font-size to 16px, like so:
html, body {
font-size: 16px;
}
This is assuming that there's no parent elements that change this font-size though, as em is a relative size to the nearest parent that sets a size. Check into rem if you want an absolutely sized font, however this isn't supported in older browsers so you'll need to provide a fallback.