em和strong的區別

em 和 strong 的區別,能夠從三個層次上來談。html

首先看 HTML 4.01 中的說明:瀏覽器

EM: Indicates emphasis.
STRONG: Indicates stronger emphasis.app

em 表示強調,strong 表示更強烈的強調。言簡意賅,代表了 em 和 strong 的命名來歷。而且在瀏覽器中,em 默認用斜體表示,strong 用粗體表示。這是第一個層次上的區別。ui

第二個層次上,在 Emphasis in context versus overall highlighting 和 em vs. strong 這兩篇文章中,作了很好的總結:this

em is for local emphasis. You see? Local emphasis. If you would emphasize a word in speech, use em. strong is for global highlighting.
When somebody looks at your document, at a glance, certain words and phrases should jump out. These are the words and phrases that make up the gist of the content — the highlights.rest

em 用來局部強調,strong 則是全局強調。從視覺上考慮,em 的強調是有順序的,閱讀到某處時,纔會注意到。strong 的強調則是一種隨意無順序的,看見某文時,馬上就凸顯出來的關鍵詞句。斜體和粗體恰好知足了這兩種視覺效果,所以也就成了 em 和 strong 的默認樣式。code

感受上面已經解釋得很清楚了?咱們再來看看第三個層次上的區別。HTML5 標準中作了詳盡解釋:htm

The em element represents stress emphasis of its contents.
The placement of emphasis changes the meaning of the sentence.——em
element
ip

The strong element represents strong importance, seriousness, or urgency for its contents.element

Importance: The strong element can be used in a heading, caption, or paragraph to distinguish the part that really matters from other parts that might be more detailed, more jovial, or merely boilerplate. (This is distinct from marking up subheadings, for which the hgroup element is appropriate.)

For example, the first word of the previous paragraph is marked up with strong to distinguish it from the more detailed text in the rest of the paragraph.

Seriousness: The strong element can be used to mark up a warning or caution notice.

Urgency: The strong element can be used to denote contents that the
user needs to see sooner than other parts of the document.

The relative level of importance of a piece of content is given by its number of ancestor strong elements; each strong element increases the importance of its contents.

Changing the importance of a piece of text with the strong element does not change the meaning of the sentence.——strong element

em 表示內容的重點(stress emphasis),strong 表示強烈的重要性、嚴重性或內容的緊迫性,strong 不會改變所在句子的語意,em 則會改變所在句子的語義。而且舉了一個很是好的例子:

<p><em>Cats</em> are cute animals.</p>

強調貓,討論的是哪一種動物聰明可愛。

<p>Cats <em>are</em> cute animals.</p>

強調事實,討論的是貓是可愛的動物的事實。

<p>Cats are <em>cute</em> animals.</p>

強調可愛,討論的是貓是否可愛。

<h1>Chapter 1: <strong>The Praxis</strong></h1>

"chapter 1"僅僅是個引用,後面strong裏的內容纔是章節真正的名字。

<figcaption>Figure 1. <strong>Ant colony dynamics</strong>. The ants in this colony are affected by the heat source (upper left) and the food source (lower right).</figcaption>
<h1><strong>Flowers, Bees, and Honey</strong> and other things I don't understand</h1>

這裏strong的使用是爲了和其餘內容區分開來。

In this example, the strong element is used to denote the part of the text that the user is intended to read first.
在這個例子裏,strong標籤是用來指示用戶優先查看的部份內容。

<p>Welcome to Remy, the reminder system.</p>
<p>Your tasks for today:</p>
<ul>
 <li><p><strong>Turn off the oven.</strong></p></li>
 <li><p>Put out the trash.</p></li>
 <li><p>Do the laundry.</p></li>
</ul>
相關文章
相關標籤/搜索