Html 有没有办法使用 CSS 删除斜体效果 <i> 标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27203574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any way to remove italic effect <i> tag using CSS?
提问by O-mkar
How do I remove italic effect of <i>
tag so I can do this:
如何删除<i>
标签的斜体效果,以便我可以这样做:
<span>
test<i>test</i>
</span>
I am filling some text in the <i>
tag using jQuery innerHtml, so it comes in italic, but I don't want the italic effect.
我正在<i>
使用 jQuery innerHtml在标签中填充一些文本,所以它是斜体的,但我不想要斜体效果。
Is there any way I can remove the italic effect using CSS?
有什么办法可以使用 CSS 去除斜体效果吗?
I cant use a different tag. I can only use the <i>
tag.
我不能使用不同的标签。我只能使用<i>
标签。
回答by Winner Crespo
You just need to use this CSS code:
你只需要使用这个 CSS 代码:
.no-italics {
font-style: normal;
}
HTML code:
HTML代码:
<span>
test
<i class='no-italics'>test</i>
</span>
回答by Bhojendra Rauniyar
Use font-style:
使用字体样式:
i {
font-style: normal;
}
回答by mehulmpt
You can do any formatting with CSS.
您可以使用 CSS 进行任何格式设置。
Like:
喜欢:
b {
font-weight: normal;
}
will change bold text to normal.
将粗体文本更改为正常。
Similarly,
相似地,
i {
font-style: normal;
}
will make <i>
font style as normal (non-italic).
将使<i>
字体样式正常(非斜体)。
回答by Drazzah
You can use the CSS style font-style: normal
to get that effect. Then you can do your jQuery to put text in the tag:
您可以使用 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>