我的网页按预期使用 Yekan 字体显示波斯文本。为什么英文文本错误地使用了 Alger 以外的字体?
@font-face { <!-- Persian Font -->
font-family: Yekan;
src: url(Fonts/BYekan.ttf);
unicode-range:U+0600-06FF;
}
@font-face { <!-- English Font -->
font-family: Alger;
src: url(Fonts/ALGER.TTF);
unicode-range: U+0020-007F;
}
最佳答案
一个元素只能添加一种字体。
技巧:尝试给他们相同的名字:
@font-face { /* Persian Font */
font-family: 'MyFont';
src: url(Fonts/BYekan.ttf);
unicode-range: U+0600-06FF;
}
@font-face { /* English font */
font-family: 'MyFont';
src: url(Fonts/ALGER.TTF);
unicode-range: U+0020-007F;
}
用法:
body {
font-family: 'MyFont';
}
这应该可以解决您的问题,但我无法测试它,因为我在移动设备上。
关于html - 在网页中显示两种语言的文本,在 css 规则中使用不同字体的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32287257/