News for hackers. Stuff that matters.
Re:How to avoid layout shifts caused by web fonts by capableweb on Sunday January 30, 2022 @06:39AM (#30136133)
Sometimes you care a lot about the design of the website and that everything looks 100% OK in all browsers and screen-sizes. For example, think web agency landing pages, where you're supposed to sell your service to potential customers.

In those cases, using whatever font is usually not good enough, because many of them have different sizes (both length-wise, height-wise and line-height-wise), so if a user gets a different font loaded than what you have tested with, it could at best just have a different size (right-side of the text is now 3px away from the side rather than 6px for example) and at worst introduce line-breaks in your buttons that only expects one line of text, making everything look very fugly.

Re:How to avoid layout shifts caused by web fonts by maccard on Sunday January 30, 2022 @11:56AM (#30138754)
If you care that much you need to bundle the font with your site.
Re:How to avoid layout shifts caused by web fonts by capableweb on Monday January 31, 2022 @07:15AM (#30147133)
Yeah, I mean... Yeah. How is that an argument for just using `body {font-family: sans-serif}`?
Re:How to avoid layout shifts caused by web fonts by Spivak on Sunday January 30, 2022 @01:07PM (#30139480)
Which is what web fonts are. But you still have to handle the case and do something reasonable if the user or user-agent doesn’t load web fonts.