0

Looking at values for the font-family attribute I sometimes see "Helvetica Neue"enclosed in quotes and other times I see for example More Pro without quotes. Do font-family values that contain spaces need to be quoted or is it ok to just use Helvetica Neue?

There's an answer to this here when-should-css-font-family-value-use-quotes, so also wondering whether this is current?

Community
  • 1
  • 1
Ole
  • 41,793
  • 59
  • 191
  • 359

2 Answers2

4

Per the spec, no it isn't required, but it is recommended.

Font family names other than generic families must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means most punctuation characters and digits at the start of each token must be escaped in unquoted font family names.

To avoid mistakes in escaping, it is recommended to quote font family names that contain white space, digits, or punctuation characters other than hyphens:

Community
  • 1
  • 1
Michael Coker
  • 52,626
  • 5
  • 64
  • 64
1

Yes, it should.

In my stylesheet, I always do enclose font with spaces as it keeps things in order.

The main reason is that, browsers will see it as a single font value, which make sense.

John Zenith
  • 472
  • 5
  • 10