在CSS中以规则显示带有不同字体的网页中的两种语言的文本 [英] Display text with two language in webpage with different fonts with font-face at rule in css
本文介绍了在CSS中以规则显示带有不同字体的网页中的两种语言的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网页按预期使用Yekan字体显示波斯语文本.为什么英文文本错误地使用了Alger以外的其他字体?
My web page displays Persian text using the Yekan font as expected. Why does the English text incorrectly use a font other than 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;
}
推荐答案
您只能向一种元素添加一种字体
技巧:尝试给他们起相同的名字:
You can add only one font to an element
Trick: Try giving them the same Name:
@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';}
这应该可以解决您的问题,但是由于我在移动设备上,因此我无法对其进行测试
This should solve your problem, but i cant test it because i'm on mobile
这篇关于在CSS中以规则显示带有不同字体的网页中的两种语言的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文