html - 如何将字体样式导入css并在页面中使用?

标签 html css wordpress

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

  @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;}

什么都没发生?

最佳答案

尝试删除第一个 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");
}

关于html - 如何将字体样式导入css并在页面中使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56011242/

相关文章:

javascript - 在没有服务器端脚本的情况下将 JSON 加载到本地 JavaScript 变量中?

javascript - 单击和链接时的 jQuery 事件

html - 保持 <ol> 溢出的边距

ios - WordPress 菜单项向右浮动和垂直对齐问题

mysql - 从表中选择 3 天之前的所有条目

html - 有没有办法防止指针/光标与使用 CSS 的选择元素后面的元素交互?

html - 如何获得类似横幅的页脚?

HTML BEM 命名约定

mysql - WordPress - 获取所有没有图像的帖子?