font-style - CSS(层叠样式表) 编辑

概述

font-style 描述符允许开发者在@font-rule规则中为指定字体样式(该条目区别于font-style,意指用在@font-rule中的font-style属性)

For a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-styledescriptor to explicitly specify the font face's style. The values for the CSS descriptor is same as that of its corresponding font property.

Related at-rule@font-face
初始值normal
适用媒体all
计算值as specified
正规顺序the unique non-ambiguous order defined by the formal grammar

Syntax

font-style: normal;
font-style: italic;
font-style: oblique;

Values

normal
Selects the normal version of the font-family.

italic
Specifies that font-face is an italicized version of the normal font .

oblique
Specifies that the font-face is an artificially sloped version of the normal font.

Formal syntax

normal | italic | oblique <angle>{0,2}

Examples

As an example, consider the garamond font family, in its normal form, we get the following result:

@font-face {
  font-family: garamond;
  src: url('garamond.ttf');
}

unstyled Garamond

The italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.

artificially sloped garamond

On the other hand, if a true italicized version of the font family exists, we can include it in the srcdescriptor and specify the font style as italic, so that it is clear that the font is italicized. True italics use different glyphs and are a bit different from their upright counterparts, having some unique features and generally have a rounded and calligraphic quality. These fonts are specially created by font designers and are not artificially sloped.

@font-face {
  font-family: garamond;
  src: url('garamond-italic.ttf');
  font-style: italic;
}

italic garamond

Specifications

SpecificationStatusComment
CSS Fonts Module Level 3
unicode-range
Candidate RecommendationInitial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
FeatureFirefox (Gecko)ChromeInternet ExplorerOperaSafari
Basic support3.5 (1.9.1)4.0  4.010.03.1
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MiniOpera MobileSafari Mobile
Basic support(Yes)1.0 (1.9.1)?未实现10.0(Yes)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:66 次

字数:6266

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文