我有下面的文本示例,我正试图通过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.
使用span
:
Tell us <span style="color: red;"> why </span>
you bought the product, and <span style="color: red;"> when </span> you bought it.
一种方法:
<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强调某些词