@字体面未加载自定义字体



我正在尝试使用一种自定义字体(.oft),该字体已上载到文件系统中的字体文件夹中。

我已经用以下内容声明了CSS中的字体:

@font-face {
    font-family: '400'; /*a name to be used later*/
    src: url('../font/400ml-Regular.otf'); /*URL to font*/
}

并称之为:

.intro .slogan {
    text-align: center;
    font-family: '400';
}

我的index.html页面在根文件夹(var/www.html)中,css和font分别在/var/www/html/css和/var/www/html/font中(所以我认为src中的'..'是正确的)。我还向.htaccess 添加了以下内容

AddType font/otf .otf

但我仍然无法在开发人员工具中看到它的加载。

有人有什么建议吗?

要使@font face在不同的浏览器和OP中工作,需要使其像一样

@font-face {
  font-family: '400';
  src: url('400ml-Regular.eot'); /* IE9 Compat Modes */
  src: url('400ml-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('400ml-Regular.woff') format('woff'), /* Modern Browsers */
       url('400ml-Regular.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('400ml-Regular.svg#svgFontName') format('svg'); /* Legacy iOS */
}

使用字体生成器生成不同的字体格式。试试fontsquiel或类似的:)

最新更新