Is number 1 in correct format? I collect it from MDN. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is number 1 in correct format? I collect it from MDN.

font-family: Gill Sans Extrabold, sans-serif; font-family: "Goudy Bookletter 1911", sans-serif;

8th Dec 2020, 5:01 AM
NUR ISLAM
NUR ISLAM - avatar
7 Answers
+ 2
According to MDN the first one is valid. But, w3.org recommends to quote font family names that contain white space, digits, or punctuation characters other than hyphens:
8th Dec 2020, 5:27 AM
Chris Coder
Chris Coder - avatar
+ 2
When you're unsure use this https://jigsaw.w3.org/css-validator/#validate_by_input Copy and paste this to check validation p {font-family: Gill Sans Extrabold, sans-serif; font-family: Goudy Bookletter 1911, sans-serif;} then this p {font-family: Gill Sans Extrabold, sans-serif; font-family: "Goudy Bookletter 1911", sans-serif;}
8th Dec 2020, 5:36 AM
Chris Coder
Chris Coder - avatar
+ 1
Both declarations are valid "Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names." - MDN
8th Dec 2020, 5:13 AM
Chris Coder
Chris Coder - avatar
+ 1
These are the guys who make the standards. https://www.w3.org/TR/CSS2/fonts.html
8th Dec 2020, 5:28 AM
Chris Coder
Chris Coder - avatar
+ 1
Chris C. Thanks
8th Dec 2020, 5:34 AM
NUR ISLAM
NUR ISLAM - avatar
+ 1
Chris C. Maybe quated format is more valid, I use this. Validators shows no warning.
8th Dec 2020, 5:43 AM
NUR ISLAM
NUR ISLAM - avatar
0
Chris C. But why it is invalid? font-family: Goudy Bookletter 1911, sans-serif; can you please make some explanation?
8th Dec 2020, 5:15 AM
NUR ISLAM
NUR ISLAM - avatar