所以我有2种字体。
@font-face {
font-family: 'helvetica neue black condensed';
src: url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.eot');
src: url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed?#iefix') format('embedded-opentype'),
url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.woff') format("woff"),
url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.ttf') format("truetype");
font-style: normal;
font-weight: normal;
}
@font-face {
font-family: 'helvetica neue black condensed oblique';
src: url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.eot');
src: url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed?#iefix') format('embedded-opentype'),
url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.woff') format("woff"),
url('/wcsstore/Html/Static/fonts/HelveticaNeueBlackCondensed/HelveticaNeueBlackCondensed.ttf') format("truetype");
font-style: oblique;
font-weight: normal;
}
如您所见,它们都引用相同的文件。第一个是正常的,第二个是倾斜的。 “ Helvetica neue black condensed”效果很好,但是由于某些原因,浏览器无法识别“ helvetica neue black condensed”。我大约有50种字体,而倾斜字体则无法使用。这是巧合吗?
请不要告诉我某些字体的使用。我有执照。
不要告诉我使字体样式:斜;在main.css中
我想要倾斜的字体系列,默认情况下倾斜。
最佳答案
正如您所说,问题中的代码在两个规则中使用相同的URL。您不能仅通过在名称中使用单词“ oblique”或对其声明font-style: oblique
来使字体倾斜。您需要在第二条规则中引用包含倾斜字体的文件。
如果没有可用的倾斜字体并且为元素声明了font-style: oblique
,则某些浏览器实际上可以对字体应用算法倾斜。 (该问题并未揭示是否是后者。)当然,这在印刷上是不好的。从实际的角度来看,在这种情况下不会发生这种情况,因为@font-face
规则将a字体声明为倾斜字体(即使它看起来很正常)。
关于css - @ font-face不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20079933/