表現(xiàn)
em vs strong
在瀏覽器中恋拷,<em>
默認(rèn)用斜體表示资厉,<strong>
用粗體表示。從樣式表現(xiàn)上蔬顾,<strong>
更加突出宴偿,更容易吸引眼光。顯然阎抒,這種視覺上的差異設(shè)計(jì)是有目的的酪我。
程度
EM: Indicates emphasis.
STRONG: Indicates stronger emphasis.
在 HTML 4.01 的說明 中,em 表示強(qiáng)調(diào)且叁,strong 表示更強(qiáng)烈的強(qiáng)調(diào)。從兩者視覺樣式上的特點(diǎn)來說秩伞,這種“程度上”的解釋確實(shí)有道理逞带。
但把二者放在一大段落、一遍文章中時(shí)纱新,讀者第一眼肯定注意到的是粗體的 strong展氓,而很難第一時(shí)間找到斜體不加粗的 em,因此往往是當(dāng)讀者讀到某一處時(shí)脸爱,才會(huì)發(fā)現(xiàn)這種強(qiáng)調(diào)遇汞,與 strong 的這種不看內(nèi)容但立刻就凸顯出關(guān)鍵詞句的強(qiáng)調(diào)相比,em 更偏向于用來局部強(qiáng)調(diào)簿废,而strong 則是全局強(qiáng)調(diào)空入。
因此,光從二者強(qiáng)調(diào)程度上的強(qiáng)弱已經(jīng)不足以說明其區(qū)別族檬。
語(yǔ)意
在 HTML 5 中歪赢,進(jìn)一步規(guī)定了兩者的區(qū)別:
The em element represents stress emphasis of its contents.
The strong element represents strong importance, seriousness, or urgency for its contents.
MDN 中也將兩者進(jìn)行了對(duì)比,Emphasis vs. Strong:
While in HTML4, Strong simply indicated a stronger emphasis, in HTML5, the element is described as representing "strong importance for its contents." This is an important distinction to make. While Emphasis is used to change the meaning of a sentence ("I love carrots" vs. "I love carrots"), Strong is used to give portions of a sentence added importance (e.g., "Warning! This is very dangerous.") Both Strong and Emphasis can be nested to increase the relative degree of importance or stress emphasis, respectively.
em 和 strong 已經(jīng)不可以再用 HTML4 中從強(qiáng)調(diào)的程度來簡(jiǎn)單區(qū)分差別了单料。
- em 表示內(nèi)容的著重點(diǎn)(stress emphasis)埋凯,放置的位置會(huì)改變所在句子的含義。
- strong 表示內(nèi)容的重要性(strong importance)扫尖,強(qiáng)調(diào)句子的重要性而不會(huì)改變所在句子的語(yǔ)意白对。
例子
注:下面的例子中,斜體為 em换怖,粗體為 strong甩恼。
Cats are cute animals.
強(qiáng)調(diào)貓,討論的是哪種動(dòng)物聰明可愛。
Cats are cute animals.
強(qiáng)調(diào)是媳拴,討論的是貓是不是可愛黄橘。
Cats are cute animals.
強(qiáng)調(diào)可愛,討論的是貓究竟是可愛還是不可愛屈溉。
"Warning! This is very dangerous".
strong 表示的是重要性上的強(qiáng)調(diào)塞关,不會(huì)引起句子意思的變化。
<p><strong>Warning.</strong> This dungeon is dangerous.
<strong>Avoid the ducks.</strong> Take any gold you find.
<strong><strong>Do not take any of the diamonds</strong>,
they are explosive and <strong>will destroy anything within
ten meters.</strong></strong> You have been warned.</p>
注:em 和 strong 均可嵌套來增強(qiáng)其程度子巾。