Extracted information from mdn docs: "Interpretation of relative weights"
Note that when utilizing relative weights, only four font variations are
recognized — thin (100), normal (400), bold (700), and heavy (900). In the event
that a font family offers more variations, they are disregarded for the
purpose of determining relative weight.
In simpler terms:
if your main text was assigned with font-weight: 400
,
an element with font-weight:lighter
would display the weight as 100 – instead of possibly anticipated 300.
This principle also extends to fonts supporting a broad range of weights (e.g variable fonts)
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 100 900;
font-stretch: 62.5% 100%;
font-display: swap;
src: url(https://fonts.gstatic.com/s/notoserif/v23/ga6Iaw1J5X9T9RW6j9bNfFcWaA.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body{
font-family:'Noto Serif';
font-weight:400
}
.lighter{
font-weight:lighter
}
.light{
font-weight:light
}
.bolder{
font-weight:bolder
}
.bold{
font-weight:bold
}
.info-text {
font-size: 32px;
line-height: 24px;
color: #15366D;
}
<h3>Implicit/relative weights</h3>
<p class="info-text lighter">p-lighter </p>
<b class="info-text bolder">b-bolder</b>
<h3>Explicit weights</h3>
<p class="info-text light">p-light </p>
<b class="info-text bold">b-bold</b>
If you desire consistent rendering across different browsers:
- load webfonts - avoid depending on default system fonts like
serif
or sans-serif
- utilize explicit font weights (bold/700 etc)