@font-face 不知何故不起作用

rai*_*nce -1 css wordpress fonts font-face

不知道我做错了什么,但是按照本教程http://sixrevisions.com/css/font-face-guide/,我在使其工作时遇到问题。

我的代码位于 style.css 顶部:

@font-face {
    font-family: 'chunkfiveregular';
    src: url('http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.eot');
    src: url('http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.eot?#iefix') format('embedded-opentype'),
         url('http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.woff') format('woff'),
         url('http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.ttf') format('truetype'),
         url('http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.svg#chunkfiveregular') format('svg');
    font-weight: normal;
    font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

我的根文件夹中包含所有文件。

我后来通过以下方式调用字体系列:

#man_translated {
    font-size: 26px;
    font-style: italic;
    line-height: 28px;
    font-family:chunkfiveregular;
}
Run Code Online (Sandbox Code Playgroud)

我在wordpress中,我使用的模板有一个预设的h1、h2、h3字体画布样式,将每个单词转换为dakota手写字体的png。也许模板中的这个核心设置与我的 onthefly javascript id/css 更改相冲突。

mai*_*ido 5

你的 css 正在工作,但也许 WordPress 正在覆盖它。尝试放置!important字体名称旁边。

例子:

#man_translated {
    font-size: 26px;
    font-style: italic;
    line-height: 28px;
    font-family: chunkfiveregular !important;
}
Run Code Online (Sandbox Code Playgroud)

或者您也可以使用相对链接。而不是 put http://careerteam.de/wp-content/themes/theme1383/css/chunkfive-webfont.eot,摆脱http://careerteam.de/并使其像这样:

url('wp-content/themes/theme1383/css/chunkfive-webfont.eot');
Run Code Online (Sandbox Code Playgroud)

小提琴