字体外观 - 自己的字体在 OPERA 中不起作用,未知 属性”

Font face - own font doesnt work in OPERA ,,unknown property"

.title_font{
        font-family: montserrat;
        src: url("/assets/font/Montserrat-Light.otf") format("opentype");
}
  @font-face {
font-family: 'montserrat';
src: url('/assets/font/Montserrat-Light.otf') format("opentype");
font-weight: bold;

}

这些都不起作用...你能帮我吗?它说未知 属性 ...字体路径很好。

可选第一步:将您的 OTF 转换为 WOFF,因为您希望浏览器知道这不仅仅是一种通用系统字体,而且您打算在线使用。 WOFF 解析不像通用系统字体规则那么严格,并且 WOFF wrap ttf/otf 使用可选的 zlib (WOFF)/brotli (WOFF2) 压缩逐字节来源,使网络上的字体明显变小。

然后,甚至不是远程可选的第二步:您将此资源定义为 在字体系列为 montserrat 时使用而权重设置为bold(或数值700,与CSS相同)。因此,当您放弃权重时,您的字体资源不适用,因为这会导致权重为 normal/400,因此应该清楚地 not 映射到@font-face 你显示的声明。

如果你想让它把你的字体应用到任何粗细,在你的 @font-face 声明中删除 font-weight 限制,或者更好的是:提供一个正确的列表,列出要使用的资源 weight/style组合。

@font-face {
  font-family: montserrat;
  src: url(.../regular.woff) format("woff");
  style: normal;
  weight: normal;
}

@font-face {
  font-family: montserrat;
  src: url(.../light.woff) format("woff");
  style: normal;
  weight: 300;
}

@font-face {
  font-family: montserrat;
  src: url(.../bolditalic.woff) format("woff");
  style: italic;
  weight: bold;
}

等等。