CSS

字体样式 | font-style

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 typediscrete
规范顺序the unique non-ambiguous order defined by the formal grammar

语法

font-style属性被指定为从下面的值列表中选择的单个关键字。

normal选择被分类为字体normal内的font-family

形式语法

normal | italic | oblique

实例

字体样式

.normal { font-style: normal; } .italic { font-style: italic; } .oblique { font-style: oblique; }

具体做法

SpecificationStatusComment
CSS Fonts Module Level 3The definition of 'font-style' in that specification.Candidate RecommendationNo change
CSS Level 2 (Revision 1)The definition of 'font-style' in that specification.RecommendationNo change
CSS Level 1The definition of 'font-style' in that specification.RecommendationInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.0(Yes)1.0 (1.7 or earlier) 14.07.01.0

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support1.0(Yes)1.0 (1) 16.06.01.0