Web速查-索引

font-style

定义

font-style 属性定义字体的风格。

注意:该属性设置使用斜体、倾斜或正常字体。斜体字体通常定义为字体系列中的一个单独的字体。理论上讲,用户代理可以根据正常字体计算一个斜体字体。

语法

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

属性值

说明 (索引中有详细介绍)
normal 默认值。浏览器显示一个标准的字体样式。
italic 浏览器会显示一个斜体的字体样式。
oblique 浏览器会显示一个倾斜的字体样式。
inherit 规定应该从父元素继承字体样式。

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>NTHOME-零基础入门学习Web(HTML5+CSS3)</title>
<style type="text/css">
.normal {font-style:normal}
.italic {font-style:italic}
.oblique {font-style:oblique}
</style>
</head>
<body>
<p class="normal">normal: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusantium commodi consequuntur, cum, deserunt eveniet fuga fugit harum in modi molestias odit omnis, possimus quidem sequi tempora ut velit. Perferendis.</p>
<br>
<p class="italic">italic: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci doloribus exercitationem magni possimus quasi? At delectus dignissimos ducimus fugiat illum suscipit voluptatibus? Aperiam assumenda enim eos itaque porro ullam! Eligendi!</p>
<br>
<p class="oblique">oblique: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad amet animi atque, commodi fugit ipsam laboriosam magnam minima nisi nulla odio odit pariatur placeat quaerat reiciendis tenetur ullam vitae voluptates!</p>
</body>
</html>

normal: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab accusantium commodi consequuntur, cum, deserunt eveniet fuga fugit harum in modi molestias odit omnis, possimus quidem sequi tempora ut velit. Perferendis.


italic: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci doloribus exercitationem magni possimus quasi? At delectus dignissimos ducimus fugiat illum suscipit voluptatibus? Aperiam assumenda enim eos itaque porro ullam! Eligendi!


oblique: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad amet animi atque, commodi fugit ipsam laboriosam magnam minima nisi nulla odio odit pariatur placeat quaerat reiciendis tenetur ullam vitae voluptates!

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号

Safari Chrome FireFox IE
1.0 1.0 1.0 8.0