Why would font names need quotes?

后端 未结 5 554
青春惊慌失措
青春惊慌失措 2020-12-02 17:58

As far as I know, one needs to use double or single quotes for fonts if they contain spaces, like:

font-family: \"Times New Roman\", Times; 
font-family: \'T         


        
5条回答
  •  天命终不由人
    2020-12-02 19:00

    You have to use quotes when there is a space in the font name. If there is no space in the font name, it's best practice to leave them off, although it won't hurt anything but your file size to have them still.

    Examples:

    font-family: "Times New Roman", Times; // ok, and best practice
    font-family: Times New Roman, Times; // incorrect, Browser won't be able to find Times New Roman
    font-family: "Times New Roman", "Times"; // ok, but has extraneous quotes around Times
    

提交回复
热议问题