有没有办法使用css </i>删除斜体效果<i>标签

时间:2014-11-29 14:54:23

标签: html css

如何删除<i>标记的斜体效果,以便

<span >test<i>test</i>
    </span>

我使用jquery内部html填充<i>标签中的一些文本,所以它以斜体显示,所以我不想要斜体效果是否有任何方法我可以使用css删除斜体效果。我无法使用其他标记,因此只需使用<i>标记。

4 个答案:

答案 0 :(得分:28)

只需要使用下一个CSS代码:

CSS代码

.no-italics {
    font-style: normal;   
}

HTML代码

<span>
   test
   <i class='no-italics'>test</i>
</span>

答案 1 :(得分:7)

使用font-style:

i{font-style:normal;}

答案 2 :(得分:5)

您可以使用CSS进行任何格式化。

喜欢:

b {
font-weight: normal;
}

会将粗体文字更改为正常。

同样,

i {
font-style: normal;
}

将使i字体样式正常(非斜体)。

答案 3 :(得分:2)

您可以使用CSS样式font-style: normal来获得该效果。然后你可以用你的jQuery将文本放在标签中:

$('i#replace').html('this text isn\'t italicized either . . . ');
i {
  font-style: normal;
  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<span>text text <i id="replace">this is NOT italic</i> text text</span>

相关问题