我有以下文本示例,我正在尝试传递w3C验证器,如何在html5和CSS中替换以下过时的<font>
?我讨厌使用<p>
或<h1,2,3>
任何其他更简单的选项?
Tell us <font color="red"> why </font> you bought the product, and <font color="red"> when </font> you bought it.
答案 0 :(得分:3)
使用span
:
Tell us <span style="color: red;"> why </span>
you bought the product, and <span style="color: red;"> when </span> you bought it.
答案 1 :(得分:0)
一种方法:
<style>
em.highlight: {
color: red;
font-style: normal;
}
</style>
...
Tell us <em class="highlight"> why </em> you bought the product, and <em class="highlight"> when </em> you bought it.
我使用<em>
,因为您正在尝试 em 对某些单词进行分析。