CSS

字体合成 | font-synthesis

font-synthesis

font-synthesis丢失哪个字体,可以通过浏览器来合成。

font-synthesis: none; font-synthesis: weight; font-synthesis: style; font-synthesis: weight style; /* Global values */ font-synthesis: initial; font-synthesis: inherit; font-synthesis: unset;

大多数西方标准字体包括斜体字和粗体字体,但许多新颖字体却没有。用于中文、日文、韩文和其他文字的字体往往不包括这些变体,综合起来可能会妨碍文本的可读性。在这种情况下,关闭浏览器的默认字体合成可能是可取的。

初始值weight style
应用于all elements. It also applies to ::first-letter and ::first-line.
是否继承yes
支持的媒体visual
计算值as specified
动画类型discrete
规范顺序order of appearance in the formal grammar of the values

语法

此属性可采取下列任何一种形式:

  • 关键字值none

  • 关键字值之一weightstyle

  • 两个关键字值weightstyle...

取值

none这个关键字表示不能合成粗体和斜体。

形式语法

none | [ weight || style ]

实例

HTML

<em class="syn">Synthesize me! 站直。</em> <br/> <em class="no-syn">Don't synthesize me! 站直。</em>

CSS

em {   font-weight: bold; } .syn {   font-synthesis: style weight; } .no-syn {   font-synthesis: none; }

结果

规范

SpecificationStatusComment
CSS Fonts Module Level 3The definition of 'font-synthesis' in that specification.Candidate RecommendationInitial definition

浏览器兼容性

FeatureFirefox (Gecko)ChromeInternet ExplorerOperaSafari (WebKit)
Basic support34 (34) 1???10.0

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?34.0 (34)1???