斜体和斜体字体样式的区别
斜体被认为是一种草书字体样式,但斜体是标准字体的倾斜版本。
但是,这两种字体样式之间存在非常小的差异。
下面的示例将显示斜体和斜体字体样式的用法:
具有 "italic" 和 "oblique" 值的 font-style 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> p.italic { font-style: italic; } p.oblique { font-style: oblique; } </style> </head> <body> <h2>Font-style 属性示例</h2> <p class="italic">我们用斜体写了这段文字。</p> <p class="oblique">我们把这段文字写成倾斜的。</p> </body> </html>
具有所有值的 font-style 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> p.normal { font-style: normal; } p.italic { font-style: italic; } p.oblique { font-style: oblique; } </style> </head> <body> <h2>Font-style 属性示例</h2> <p class="normal">We wrote this text as normal.</p> <p class="italic">We wrote this text as italic.</p> <p class="oblique">We wrote this text as oblique.</p> </body> </html>
语法
font-style: normal | italic | oblique | initial | inherit;
font-style 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> h3.normal { font-style: normal; } </style> </head> <body> <h2>Font-style 属性示例</h2> <h3 class="normal">将字体设置为斜体</h3> <p>生活本就是矛盾的,白天与黑夜间的距离,春夏秋冬之间的轮回,于是有了挑剔的喜爱,让无奈加上了喜悦的等待。 是谁把光阴剪成了烟花,一瞬间,看尽繁华。是谁把思念翻起了浪花,一转身,浪迹天涯。 </p> </body> </html>
CSS font-style 属性值说明
值 | 描述 |
---|---|
normal | 意味着文本字符将是正常的。这是此属性的默认值。 |
italic | 文本将显示为斜体。 |
oblique | 文本将显示为斜。 |
initial | 使属性使用其默认值。 |
inherit | 从父母元素继承属性。 |
font-style 属性定义文本的字体样式。
该属性具有三个值:正常、斜体和倾斜。
Oblique 是一种倾斜 8-12 度的罗马字体。
斜体是字体设计者使用特定字符创建的另一个值,特别是小写的“a”,用于创建书法和斜体版本。
浏览器对倾斜的支持较少。
浏览器对倾斜的支持较少。
初始值 | normal |
---|---|
应用于 | 所有元素。它还适用于伪元素::first-letter 和 ::first-line。 |
继承 | 可继承 |
可动画的 | 无效 |
版本 | CSS1. |
DOM 语法 | object.Style.fontstyle ="oblique"; |
日期:2020-06-02 22:14:32 来源:oir作者:oir