I've seen multi-word font families encapsulated with single quotes, double quotes and no quotes.
Are there browser compatibility issues with any of the above?
font-family:Lucida Sans Unicode, Lucida Grande, sans-serif;
font-family:'Lucida Sans Unicode', Lucida Grande', sans-serif;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-family:"Lucida Sans Unicode", Lucida Grande, sans-serif;
font-family (CSS property)
Essentially, you can do whatever you want, though it's best to put it in double-quotation marks.
These paragraphs from the link samanime gave above should clarify the situation a little:
The values are either font family names or generic family names. Font family names are quoted or unquoted strings, while generic family names are keywords and shouldn’t be quoted.
It’s a good idea to quote any font family name that contains spaces or other non-alphanumeric characters. Special characters must be escaped if the value isn’t quoted. Whitespace characters will be ignored at the beginning or end of an unquoted name, and multiple white space characters inside the name will collapse to a single space.
Also, if a font family name happens to be the same as a generic family name or any other CSS keyword, it must be quoted to avoid confusion.
Thanks guys. I appreciate the references and explanation. It appears that its more a recommendation than a rule. However, no specifics on single vs double quotes, so I suppose that doesn't matter.
Either/or are fine as long as they are correctly matched.
This is the way I do it. Not saying my way is by definition correct, but from the research and reading I've done, this is considered "best practices."
This topic is now closed. New replies are no longer allowed.