字体样式 | font-style
font-styleCSS 属性指定字体是否应用普通、斜体或斜面从font-family中进行样式设置。
font-style: normal;
font-style: italic;
font-style: oblique;
/* Global values */
font-style: inherit;
font-style: initial;
font-style: unset;斜体字体通常是草书,通常使用的横向空间少于未使用的横向空间,而斜面通常只是正常面的倾斜版本。当指定的样式不可用时,通过人为地倾斜常规面的字形(用于font-synthesis控制此行为)来模拟斜体和斜面。
初始化 | normal |
|---|---|
应用于 | all elements. It also applies to ::first-letter and ::first-line. |
是否继承 | yes |
支持的媒体 | visual |
计算值 | as specified |
Animation type | discrete |
规范顺序 | the unique non-ambiguous order defined by the formal grammar |
语法
该font-style属性被指定为从下面的值列表中选择的单个关键字。
值
normal选择被分类为字体normal内的font-family。
italic选择分类为的字体italic。如果脸部没有斜体版本,则使用分类为的一个oblique。如果两者都不可用,则风格是人为模拟的。
oblique选择分类为的字体oblique。如果没有可用的斜面版本,则使用分类为的一个italic。如果两者都不可用,则风格是人为模拟的。
形式语法
normal | italic | oblique实例
字体样式
.normal {
font-style: normal;
}
.italic {
font-style: italic;
}
.oblique {
font-style: oblique;
}具体做法
Specification | Status | Comment |
|---|---|---|
CSS Fonts Module Level 3The definition of 'font-style' in that specification. | Candidate Recommendation | No change |
CSS Level 2 (Revision 1)The definition of 'font-style' in that specification. | Recommendation | No change |
CSS Level 1The definition of 'font-style' in that specification. | Recommendation | Initial definition |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.0 (1.7 or earlier) 1 | 4.0 | 7.0 | 1.0 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.0 (1) 1 | 6.0 | 6.0 | 1.0 |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

