Difference between “font-family” and font-family?

半世苍凉 提交于 2019-12-24 04:22:31

问题


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.]


回答1:


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.



来源:https://stackoverflow.com/questions/20709857/difference-between-font-family-and-font-family

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!