如何将字体样式导入到CSS并在页面中使用?

时间:2019-05-06 19:27:19

标签: html css wordpress

我正在尝试使用一种名为neontubes的字体,并将以下代码导入并放置在WordPress的样式CSS中。

  @font-face { 
    font-family: 'neontubes';
    src:  url('https://bitbucket.org/kennethjensen/webfonts/raw/fc13c1cb430a0e9462da56fe3f421ff7af72db71/neontubes/neontubes-webfont.eot'); 
    src:  url('https://bitbucket.org/kennethjensen/webfonts/raw/fc13c1cb430a0e9462da56fe3f421ff7af72db71/neontubes/neontubes-webfont.eot?#iefix') format('embedded-opentype'),
          url('https://bitbucket.org/kennethjensen/webfonts/raw/fc13c1cb430a0e9462da56fe3f421ff7af72db71/neontubes/neontubes-webfont.woff2') format('woff2'),
          url('https://bitbucket.org/kenneth jensen/webfonts/raw/fc13c1cb430a0e9462da56fe3f421ff7af72db71/neontubes/neontubes-webfont.woff') format('woff'), 
          url('https://bitbucket.org/kennethjensen/webfonts/raw/fc13c1cb430a0e9462da56fe3f421ff7af72db71/neontubes/neontubes-webfont.ttf')

然后我尝试使用div类进行样式设置。

.event {font-family: neontubes;}

什么都没发生?

1 个答案:

答案 0 :(得分:1)

尝试在您的第一个URL之后删除分号。另外,您不能具有多个src属性。这是一个示例:

@font-face {
    font-family: ProximaNovaLight;
    src: url("/Portals/0/Fonts/ProximaNova-Light.woff") format("woff"), url("/Portals/0/Fonts/ProximaNova-Light.ttf")  format("truetype");
}