Why would font names need quotes?

后端 未结 5 569
青春惊慌失措
青春惊慌失措 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 18:56

    For two reasons;

    1. When an actual font-family name shares the same name as a generic family name, to avoid confusion with keywords with the same names e.g.

    p {font-family: 'Shift', sans-serif;}

    1. When there are more than one word in a font-family name e.g.

    p {font-family: 'Times New Roman', ..... , a generic family name here ;}

提交回复
热议问题