解说HTML 5 语义化
在当今的 Web 标准中,b 和 i 标签并不被推荐使用,甚至可以说遭到反对。这是因为它们仅仅用于呈现粗体和斜体的视觉效果,而不具备任何语义信息。在实际应用中,更多地会使用 strong 和 em 标签来替代它们。
不过,在新的 HTML5 工作草案中,对 b 和 i 标签有了新的定义。从规范中我们可以注意到,b 和 i 元素将被赋予真正的语义。因此,我们需要更有预见性地关注 b、i 与 strong、em 在使用上的区别。
b 元素的新定义
b 元素现在表示一段在普通文章中仅从文体上突出,但不传达任何额外重要性的文本。例如,文档概要中的关键字、评论中的产品名,或者那些通常采用加粗排版方式的文本。具体英文描述如下:
The b element now represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is emboldened.
i 元素的新定义
i 元素现在表示一段在普通文章中突出不同意见、语气或其他情况的文本。比如,一个分类名称、一个技术术语、一个外语中的谚语、一个想法、船名,或者那些通常采用斜体排版方式的文本。其使用方式在不同语言中差异较大。具体英文描述如下:
The i element now represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized. Usage varies widely by language.