HTML and CSS Reference
In-Depth Information
Because fonts vary wildly among browsers, you should usually provide
several choices when specifying a font style, ending with a suitable gen-
eric font. For example:
h1 {font-family: Helvetica, Univers, sans-serif}
causes the browser to look for and use Helvetica, and then Univers. If
neither font is available for the client display, the browser uses the gen-
eric sans-serif typeface.
Enclose font names that contain spacesNew Century Schoolbook, for ex-
amplein quotation marks. For instance:
p {font-family: Times, "New Century Schoolbook", Palatino, serif}
With inline styles, that extra set of double quotation marks causes prob-
lems. The solution is to use single quotation marks in an inline style:
<p style="font-family: Times, 'New Century Schoolbook', Palatino, serif">
In practice, you don't have to use quotation marks, because font-
name values are comma separated, so the browser normally ignores the
spaces. Hence, both of the following are legal:
p {font-family: Times, New Century Schoolbook, Palatino, serif}
<p style="font-family: Times, New Century Schoolbook, Palatino, serif">
Nonetheless, we recommend that you use quotation marks. It's a good
habit to get into, and it makes things that much less ambiguous.
 
Search WWH ::




Custom Search