Html CSS从otf导入字体

Html CSS从otf导入字体,html,css,fonts,Html,Css,Fonts,伙计们,我在从otf文件导入字体时遇到了麻烦 main.css @font-face { font-family: 'testfont'; src: url('fonts/test.otf'); } .fonttest { font-family: 'testfont'; } main.html <p class="fonttest">TESTtest</p> TESTtest 但当我尝试启动主页时,它仍然显示html的标准字体。 当我在浏

伙计们,我在从otf文件导入字体时遇到了麻烦

main.css

@font-face {
    font-family: 'testfont';
    src: url('fonts/test.otf');
}

.fonttest {
    font-family: 'testfont';
}
main.html

<p class="fonttest">TESTtest</p>
TESTtest

但当我尝试启动主页时,它仍然显示html的标准字体。 当我在浏览器opera和chrome上使用inspector时,它会显示字体已被接受

@font-face {
    font-family: testfont;
    src: url("fonts/test.otf") format("opentype");
}

您可以使用@font-face实现OTF字体,如:

@font-face {
    font-family: testfont;
    src: url("fonts/test.otf") format("opentype");
}

@font-face {
    font-family: testfont;
    font-weight: bold;
    src: url("fonts/test.otf") format("opentype");
}

应用哪种字体,并且可以在开发工具中验证字体URL是否正确,以及是否正确地传输到客户端?而且,您正在使用的Opera版本支持OTF字体格式?“当我在浏览器Opera和chrome上使用inspector时,它表示该字体已被接受”-不,它不支持。这仅显示您指定了某个字体系列名称。