Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
`font-family: Comic Sans MS` (without quotes) is valid, working CSS (mathiasbynens.be)
30 points by mathias on April 3, 2012 | hide | past | favorite | 5 comments


This is an interesting bit of trivia and fun to know, but I beg front end devs: PLEASE do not take this as anything more than an interesting bit of trivia. Please do not incorporate this information into your workflow; it would be pure folly as it introduces complexity, potential confusion, and potential bugs and yields infinitesimally small returns.

Thank you mathias for writing about this, it's neat to know how these things work!


Nice post, and a good explanation of how CSS handles identifiers and strings. But I can't figure out why you'd want to specify a font-family without using quotes. To save two bytes?


By using a string you are specifying on a particular installed font. For doing a fallback where the system chooses the particular appropriate font within a family, using the identifier form is better. See sans-serif vs. 'sans-serif' in that article.


I understand that CSS' generic fonts must be given as an identifier. I was wondering why you'd want to give a specific font family without quotes. These are equivalent, but I don't get why you'd use the former:

    font-family: Helvetica Neue, Helvetica, sans-serif;
    font-family: 'Helvetica Neue', 'Helvetica', sans-serif;


Why not? :)




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

Search: