Home > Web Front-end > Front-end Q&A > How to prevent font tilt in css

How to prevent font tilt in css

藏色散人
Release: 2023-01-04 09:36:44
Original
4855 people have browsed it

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.

How to prevent font tilt in css

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>
Copy after login

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>
Copy after login

3. Effect

How to prevent font tilt in css##

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!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template