Demo of font-size-adjust
Default serif font. |
Slow loading web font (with font-size-adjust) |
Slow loading web font (without font-size-adjust) |
---|---|---|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
This element beneath the lorem ipsum has no CLS.
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
This element beneath the lorem ipsum has nearly no CLS.
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
This element beneath the lorem ipsum has lots of CLS.
|
Instructions:
- Wait for the page (including the web font) to fully load. Enjoy the CLS when the web font does load. 😔
- Right click and Inspect the middle lorem ipsum text to open DevTools and see it's styles.
-
Toggle
font-size-adjust: 0.526
in DevTools Styles panel on and off. Notice it doesn't seem to affect the page. This suggests thefont-size-adjust
CSS property isn't doing anything. -
Change
font-size-adjust: 0.526
in DevTools Styles panel tofont-size-adjust: 0.4
(or any value). Notice the text size changes, showing the font-size-adjust CSS property IS doing something.
But with the magic value of font-size-adjust: 0.526
the adjustment it
makes to the final font is the adjustment the font does anyway.
So even though it IS affecting the final font, it's setting it to the value the
final font would have used anyway. So it's almost like it doesn't affect the final
font. But it does. And crucially it still affects the fallback font too (but in a
much bigger way since 0.526
is not the "magic value" for it).