Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "font-family" and font-family?

I just discovered that my Chrome will treat font-family: "sans-serif" and font-family: sans-serif differently (it will choose different fonts). Can anyone explain how this works? I can't find any clues in the specs. [edit: ...as I obviously didn't read them very carefully.]

like image 710
leo Avatar asked Oct 24 '25 02:10

leo


1 Answers

From the same specs:

If a sequence of identifiers is given as a font family name, the computed value is the name converted to a string by joining all the identifiers in the sequence by single spaces.

To avoid mistakes in escaping, it is recommended to quote font family names that contain white space, digits, or punctuation characters other than hyphens:

So when you are writing "san-serif" then it is a specific font and is considered as a string whereas the latter is considered as generic.

like image 111
Rahul Tripathi Avatar answered Oct 25 '25 18:10

Rahul Tripathi