gpt4 book ai didi

css - @font-face 只影响某些字符

转载 作者:太空宇宙 更新时间:2023-11-04 15:47:46 24 4
gpt4 key购买 nike

使用自定义字体构建网站。从设计师那里得到 .ttf 文件。

CSS 看起来像这样:

@font-face{
font-family:MenuFont;
src: url("http://www.website.com/assets/fontfile.ttf");
}

.divClass{font-family:MenuFont;}

我试过他给我的几个不同的字体文件。其中一个根本没有出现。更奇怪的是,其中一些只影响某些字母。例如,插入一个文件只会使 O、R、C 和 P 使用正确的字体。我检查了一下,它在浏览器中都是相同的字母。

在 firebug 中查看,当我滚动字体文件 url 时,我可以看到整个字体,所以我的 url 没问题,浏览器正在获取字体。

我在这里错过了什么?

最佳答案

使用 FontSquirrel 生成正确的 font-face 代码和所有需要的字体。请参阅:http://www.fontsquirrel.com/fontface/generator

您将获得更扩展和兼容的font-face 声明。像这样:

@font-face {
font-family: 'Meran';
src: url('../fonts/meran-normal-webfont.eot');
src: url('../fonts/meran-normal-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/meran-normal-webfont.woff') format('woff'),
url('../fonts/meran-normal-webfont.ttf') format('truetype'),
url('../fonts/meran-normal-webfont.svg#Meran') format('svg');
font-weight: normal;
font-style: normal;
}

关于css - @font-face 只影响某些字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11564940/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com