Home > Article > Web Front-end > How to prevent font tilt in css
How to implement css to prevent the font from tilting: first create an HTML sample file; then define a set of divs; and finally set the attribute "div_normal i{ font-style:normal}" to prevent the text from tilting.
The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.
Recommended: "css Video Tutorial"
The font-style attribute is compatible with major browsers and is used to set the display style of text. Use font-style:normal to prevent text from being slanted.
Value:
normal: normal font
italic: italic. For special fonts without italic variables, oblique
oblique will be applied: italic font
Below, we set the text font in the div box to italic italic, oblique italic, using font- style:normal removes the default italic style of the html italic tag.
1. css code:
<style> .div_italic{ font-style:italic} .div_oblique{ font-style:oblique} .div_normal i{ font-style:normal} /* 去掉div_normal对象I斜体标签默认斜体样式 */ </style>
2. HTML code snippet:
<div class="div_italic">我被加斜体</div> <div class="div_oblique">我被加倾斜</div> <div><i>我加I标签斜体</i></div> <div class="div_normal"><i>I斜体被CSS去掉</i></div>
3. Effect
##
The above is the detailed content of How to prevent font tilt in css. For more information, please follow other related articles on the PHP Chinese website!