有什么区别?他们都强调文本。
<em>
标记将文字显示为斜体,而<strong>
则将文字设为粗体,这是唯一的区别吗?
答案 0 :(得分:56)
是的,“强调”与“强调”相比较的定义非常明显。唯一的标准定义将是“它强调,但更多 !!”。
我个人使用<em>
进行正常强调,你会用不同的语调读取强调的单词,<strong>
表示你使用关键词和短语1}} strong>从文本中挑选它们以帮助人们浏览文本挑选出主题。
这不是一个标准的解释,但它有一定的意义,并通过默认的斜体/粗体样式进行适当的渲染。无论你做什么,保持一致。
答案 1 :(得分:14)
&LT;强&GT;是一个围绕句子或短语的标记,表示“这比周围文本更重要”。
&LT; EM&GT;通常用于表示句子中单词的压力。
例如:
尽管有些人可能会说, 是元素之间的语义差异。
为了明确区分压力强调和重要性,以及更多示例,see the HTML 5 draft。
答案 2 :(得分:6)
答案 3 :(得分:3)
请注意the difference is going to change:
在HTML 4.01中,定义了
<strong>
标记 强调强调文本,但在HTML 5中 它定义了重要的文本。
不会让问题更清楚,是吗?
答案 4 :(得分:1)
来自WHATWG的Living standard HTML spec:
em 代表其内容的重点:
These examples show how changing the stress emphasis changes the meaning. First, a general statement of fact, with no stress: <p>Cats are cute animals.</p> By emphasizing the first word, the statement implies that the kind of animal under discussion is in question (maybe someone is asserting that dogs are cute): <p><em>Cats</em> are cute animals.</p> Moving the stress to the verb, one highlights that the truth of the entire sentence is in question (maybe someone is saying cats are not cute): <p>Cats <em>are</em> cute animals.</p> By moving it to the adjective, the exact nature of the cats is reasserted (maybe someone suggested cats were mean animals): <p>Cats are <em>cute</em> animals.</p> Similarly, if someone asserted that cats were vegetables, someone correcting this might emphasise the last word: <p>Cats are cute <em>animals</em>.</p> By emphasizing the entire sentence, it becomes clear that the speaker is fighting hard to get the point across. This kind of stress emphasis also typically affects the punctuation, hence the exclamation mark here. <p><em>Cats are cute animals!</em></p> Anger mixed with emphasizing the cuteness could lead to markup such as: <p><em>Cats are <em>cute</em> animals!</em></p>
强烈代表其内容的重要性,严肃性或紧迫性:
<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>
答案 5 :(得分:0)
em
:表示强调。
strong
:表示更强调。
它在用户可访问性工具(NVDA)中的作用。
它对搜索引擎优化也有影响。