At 03:18 AM 7/16/2005, designer wrote:

I was 'brought up' to believe that, when specifying fonts, one should quote a family such as 'Verdana, Arial, Sans Serif'. This means, of course, that if a user doesn't have Verdana, the page will select the next available font on his/her system.

However, when I validate CSS, it tells me that I should only do this as a last resort, So my questions are: 'what is the first resort' these days? What is the standards way? What do you guys do?


Bob,

The W3C spec doesn't seem to warn against listing multiple fonts:
http://www.w3.org/TR/CSS21/fonts.html

I don't recall ever having received a W3C validation error or warning about my use of multiple font names. I suspect your warning was based on your typographical errors: sans-serif should be hyphenated, and you're not supposed to enclose the entire list of font families in quotation marks, but rather individual font families should be quoted when they're multiple words, e.g.:

        body {font-family: Times, "Times New Roman", serif;}

So I would change your:
        'Verdana, Arial, Sans Serif'
to:
        Verdana, Arial, Sans-Serif

Here's an excerpt from the spec:
________________________________

<generic-family>
In the example above, the last value is a generic family name. The following generic families are defined:

        * 'serif' (e.g. Times)
        * 'sans-serif' (e.g. Helvetica)
        * 'cursive' (e.g. Zapf-Chancery)
        * 'fantasy' (e.g. Western)
        * 'monospace' (e.g. Courier)

Style sheet designers are encouraged to offer a generic font family as a last alternative. Generic font family names are keywords and must NOT be quoted.

If an unquoted font family name contains parentheses, brackets, and/or braces, they must still be escaped per CSS grammar rules. Similarly, quotation marks (both single and double), semicolons, exclamation marks, commas, and leading slashes within unquoted font family names must be escaped. Font names containing any such characters or whitespace should be quoted:

body { font-family: "New Century Schoolbook", serif }
________________________________

Regards,
Paul


______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to