Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why isn't `sans-serif` just the default sans-serif font? Why do we need a new keyword to get the actual default font?


I wish browsers chose better default fonts which would make monospace, sans-serif, and serif more appealing. As an alternative, adopting new CSS keywords like user-monospace, user-sans-serif, user-serif could allow web developers to prioritize user-configured fonts in the browser.


Because whatever is default depends on too many variables.

Like if you're on a Japanese OS but your language preferences are English, the default sans-serif font is a Japanese typeface that often doesn't display Roman alphabets that nicely.


> Like if you're on a Japanese OS but your language preferences are English, the default sans-serif font is a Japanese typeface

Please specify your environment. I use Japanese OS and I haven't found a single OS/browser combo would do that.

Use Windows as an example, sans-serif by default = Arial for Chrome and Firefox for English content.

And as a bonus, you can even adjust the default sans-serif font in browser setting to your like; while with these hard-coded CSS, you can't.


MacOS Monterey, default system language is Japanese but obviously I browse a lot of English websites.

Using plain sans-serif, I get Hiragino Kaku Gothic ProN as my default font instead of something nice like Helvetica Neue.


Do you mean lang:ja or lang:en content?

Because I feel like the former is meant to have Japanese fonts even for Latin glyphs for consistency's sake, but I understand that some people do prefer the other way.

And indeed, MacOS system font by default is like that. Windows is the opposite, though (everything is in Meiryo UI or whatever it's now called.) (Not sure if it's changed in Win11 either.)


> Do you mean lang:ja or lang:en content?

Not the OP, but I'm sure it's webpages that don't have the lang attribute at all, which is why macOS used the Japanese font stack instead of the English one.


On Windows at least (can't test MacOS at the moment), the default `lang` of web page when there is no attribute is actually the display language of my browser (in both my and OP's case, English), not my OS's (Japanese).

Furthermore, Firefox has a heuristic lang detection algorithm (!) based on content. I wrote an article about it 10 years ago, but not sure if it has been changed.


> the default `lang` of web page when there is no attribute is actually the display language of my browser (in both my and OP's case, English)

Uhh, let me check...

> MacOS Monterey, default system language is Japanese but obviously I browse a lot of English websites.

I don't think that OP ever stated that their browser is in English, just saying that they also browse English sites (and they're probably not using Firefox - its text rendering is super consistent across different systems). Safari (obviously) and Chrome (less obviously) in macOS defers to the OS for text rendering - hence the problem.


For backwards compatibility, most likely. If sans-serif on a particular platform has been FontX for 25 years browser vendors probably don’t want to suddenly change it for all existing websites.


All I hear is that we have a chance to improve websites that have been ugly for the past 25 years because of bad browser defaults.


And break a lot of websites whose layout is tightly coupled to the details of font sizes.


Those sites have always been broken for a lot of people, so this would only break them for a different group of people…


It is the browser's default sans-serif font. This may not align with the OS's default interface font.


That's kinda the point of these font stacks right!? You want to fall back to the default sans-serif font only if you didn't some better font first.


That's not how I see it. I see it as not trusting that the default is good looking so we'll list a bunch of good-looking fonts with the hope that we get a hit and the browser doesn't use an ugly default.


Better? Better than the default?

So… you think your font of choice would be better than what the user had configured as the default in their user agent?


If the user wants their styles to take precedence, that’s what UA override stylesheets are for. Defaults are not overrides. Defaults are fallbacks, for sites that don’t care.


If the site cares about such things, then yes.


Highly underrated comment.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: