<分区>
<分区>
我有一个 html 和 css 代码。我想使用我下载的一种特殊字体,在搜索了一些之后,我写了下面的代码:
<head>
<style>
@font-face
{
font-family: paraaminobenzoic;
src: url('paraaminobenzoic.otf');
}
p.custom_font {font-family: paraaminobenzoic;}
</style>
</head>
它不起作用,我不知道为什么。特别是我不知道我是否在正确的位置添加了下面的代码。
p.custom_font {font-family: paraaminobenzoic;}
谁能帮忙注意到这个问题?
最佳答案
字体的正确格式应该是:
@font-face{
font-family: 'MyWebFont';
src: url('WebFont.eot');
src: url('WebFont.eot?iefix') format('eot'),
url('WebFont.woff') format('woff'),
url('WebFont.ttf') format('truetype'),
url('WebFont.svg#webfont') format('svg');
}
TTF - 适用于除 IE 和 iPhone 以外的大多数浏览器。
EOT - 仅限 IE。
WOFF - 压缩的新兴标准。
SVG - iPhone/iPad。
看这里: http://www.fontspring.com/support/installing_webfonts/how-do-i-use-the-webfonts
关于html - 在 html 和 css 中使用特定字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20546885/