我正在尝试使用一种名为 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/