语义化
语义化是指使用更符合实际语义方式来给关键词或标签命名。例如,在 html 语言中,使用<img/>作为图片标签(Image)。
<img src="assets/test.jpeg">错误案例
虽然语义化的概念已经普及,但仍有一大批开发者会使用一些本身毫无意义,而只能实现功能的标签。div 与 span 的滥用 就是一个最常见的情况。
这里举一个最简单的例子,以强调**“专有名词**”和**“重点内容”**为例:
<p> Knowledges which discuss <span style = "font-weight: bold;">"what is it"</span> or <span style = "font-weight: bold;">"how is it"</span> are called <span style = "font-style: italic">Declarative Knowledge</span>. This kind of knowledges, usually, can be described clearly through language.</P>其效果如下:
Knowledges which discuss "what is it" or "how is it" are called Declarative Knowledge. This kind of knowledges, usually, can be described clearly through language.
正确的代码应为:
<p> Knowledges which discuss <strong>"what is it"</strong> or <strong>"how is it"</strong> are called <em>Declarative Knowledge</em>. This kind of knowledges, usually, can be described clearly through language.</P>其效果如下:
Knowledges which discuss "what is it" or "how is it" are called Declarative Knowledge. This kind of knowledges, usually, can be described clearly through language.