Home > Web Front-end > H5 Tutorial > body text

HTML5 中的 b/strong,i/em 有什么区别?

WBOY
Release: 2016-06-07 08:42:30
Original
3139 people have browsed it

回复内容:

在HTML4.01中:
是视觉要素(presentationl elements),分别表示无意义的加粗,无意义的斜体,表现样式为 { font-weight: bolder },仅仅表示「这里应该用粗体显示」或者「这里应该用斜体显示」,此两个标签在HTML4.01中并不被推荐使用;

和 是表达要素(phrase elements)。 (emphasized text)表示一般的强调文本,而 (strong emphasized text)表示比 语义更强的的强调文本。

而在新的 HTML5 工作草案 中:

和 仍旧是表达要素(phrase elements)。但这时的 表示html页面上的强调(emphasized text), 表示句子中的强调(即强调语义)

对于 b 和 i 标签是这样定义的:
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.

// b 元素现在描述为在普通文章中仅从文体上突出的不包含任何额外的重要性的一段文本。例如:文档概要中的关键字,评论中的产品名。或者代表强调的排版方式。

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.

// i 元素现在描述为在普通文章中突出不同意见或语气或其他的一段文本,例如:一个分类名称,一个技术术语,一个外语中的谚语,一个想法等。或者代表斜体的排版方式。

从规范中可以注意到:b 和 i 元素将被赋予真正的语义。更应有预见性注意 b 、i 与 strong 、em 的不同使用 。

参考文档:planabc.net/2008/03/14/ 应该说,在默认的 HTML 样式表定义中,b 和 strong 的样式一样,为 { font-weight: bolder };而 em 的默认样式为 { font-style: italic },与 i 相同。

在 HTML 4 中,em 表示 emphasized text,strong 表示 strong emphasized text,故 strong 的强度要更强。而在 HTML 5 中,strong 的定义改成了 important text。当然 emphasized 和 strong emphasized 乃至 important 之间怎么界定很模糊,关键是在自己编写 HTML 代码的时候保持使用上一致。

b 和 i 仅仅表示「这里应该用粗体显示」或者「这里应该用斜体显示」。

参考:
  1. Default style sheet for HTML 4: w3.org/TR/CSS2/sample.h
在默认的html样式中,的样式一样。不过从语义上来讲是表现元素,仅仅改变外观,分别意味着行为的强调和加重强调,在搜索引擎中更受重视,一些语音阅读器也会根据它在阅读时加强语气。

另外所有的表现元素其实都是不推荐使用的,应该使用css来代替 在没有被 CSS 定义的情况下,b 和 strong 在同一浏览器内的显示效果相同 — 该要素内的文字变粗了。在语义表达上,strong 表示的强度比 em 更强。另外,b 要素是视觉要素(presentationl elements);em 和 strong 是表达要素(phrase elements)。 我听说.....

em-emphasis 是强调

跟 strong 一样,

在搜索引擎中权重会高些。

而b 只是简单的 bold 或者black?

没有强调色彩。

所以重要内容或关键词用 em or strong

不重要的表象,用b 从将代码语义化的角度来讲:

strong:加重语气。最重的那种。

em:同为加强语气,但气势弱些。

b:是单纯的加粗,没感情色彩。 現在i都代表icon了。 在编写语意化的html时候确实很容易弄错。
HTML中i、em、b、strong的区别
What's the difference between and , and ? 就是bold,字体加粗
是要表达强调而字体被加粗

就是italic,字体斜体
也是强调内容,而被倾斜

这两组标签在实现方式上都是一样的,但使用的意义不同。 默认效果:i和em都是斜体。b和strong都是加粗。没有太多的泣别。
但是em和strong的语义性更强烈,对于搜索引擎的爬蛛来说更友好,能让它知道你这里面的内容的语义效果,b和i只对视觉效果进行了强调,而语义上没有帮助
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!