CSS参考手册
字体 | Fonts
字体样式 | font-style
font-style
CSS 属性指定字体是否应用普通、斜体或斜面从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 |
字体 | Fonts相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。