+ 2

Why would font names need quotes?

As far as I know, one needs to use double and single quotes for the fonts if they contain space like:- font-family: "Times New Roman", Times; But on Google fonts(https://fonts.google.com/), I also see font-family: 'Rubik', sans-serif; Some even use it like so: font-family: 'Margarine', 'Helvetica', arial; I find this weird, as the following works as well: font-family: Margarine, Helvetica, arial; font-family: Cambria, serif; So what is the correct usage of quotes around font name in CSS?

26th Aug 2020, 4:00 AM
Rishbabh Sharma
Rishbabh Sharma - avatar
1 Odpowiedź
+ 8
Quotes are used for fonts that have spaces in their name - that are more than one word. For single-word fonts, you don’t have to put quotes, but you can if you want - entirely your decision.
26th Aug 2020, 4:04 AM
Rowsej
Rowsej - avatar