b/strong和i/em的区别

一句话理解:
b和i是样式上强调。
strong和em是语义上强调。
<em>用来局部强调,<strong>则是全局强调。从视觉上考虑,<em>的强调是有顺序的,阅读到某处时,才会注意到。
<strong>的强调则是一种随意无顺序的,看见某文时,立刻就凸显出来的关键词句。
<b><i> 仅用来使文本呈现粗体和斜体,区别其它文本,不会产生任何语义的变化。具体详情如下:

<i>

根据 W3C 对 <i> 的定义:

The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts.

翻译一下就是:i 元素代表在普通文本中具有不同语态或语气的一段文本,某种程度上表明一段不同特性的文本,比如一个分类学名称,一个技术术语,一个外语习语,一个音译,一个想法,或者西方文本中的一艘船名。

// 分类学名称

<p>The <i class="taxonomy">Felis silvestris catus</i> is cute.</p>

// 术语
<p>The term <i>prose content</i> is defined above.</p>

// 外语习语
<p>There is a certain <i lang="fr">je ne sais quoi</i> in the air.</p>

<b>

根据 W3C 对 <b> 的定义:

The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.

翻译一下就是:b 元素代表侧重实用目的而不带有任何额外重要性也不暗示不同语态或语气的一段文本,比如一段文本摘要中的关键词、一段审查中的产品名称、文本驱动软件中的可执行语句或者一篇文章的导语。

// 下面的 b 元素起到突出关键词的作用,但不具备强调重要性的作用

<p>The <b>frobonitor</b> and <b>barbinator</b> components are fried.</p>

// 下面的 b 元素让被包围的词特殊化
<p>You enter a small room. Your <b>sword</b> glows
brighter. A <b>rat</b> scurries past the corner wall.</p>

// 下面的 b 元素标注了文章的导语
<article>
  <h2>Kittens 'adopted' by pet rabbit</h2>
  <p><b class="lede">Six abandoned kittens have found an
unexpected new mother figure — a pet rabbit.</b></p>
  <p>Veterinary nurse Melanie Humble took the three-week-old
kittens to her Aberdeen home.</p>
  ...
</article>

<em>

根据 W3C 对 <em> 的定义:

The em element represents stress emphasis of its contents.

翻译一下就是:em 元素代表对其内容的强调强调位置的不同通常会带来整个句子含义的变化。看下面举的例子:

// 这是一句不带任何强调的句子

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

// em 包围 Cats,强调猫是种可爱的动物,而不是狗或者其他动物
<p><em>Cats</em> are cute animals.</p>

// em 包围 are,代表句子所说是事实,来反驳那些说猫不可爱的人
<p>Cats <em>are</em> cute animals.</p>

// em 包围 cute,强调猫是一种可爱的动物,而不是有人说的刻薄、讨厌的动物
<p>Cats are <em>cute</em> animals.</p>

// 这里强调猫是动物,而不是植物
<p>Cats are cute <em>animals</em>.</p>

<strong>

根据 W3C 对 <strong> 的定义:

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

翻译一下就是:strong 元素代表内容的强烈的重要性、严重性或者紧急性。

重要性

<strong> 元素可以被用在标题(heading)、说明(caption)或者段落(paragraph)上,来显示这部分被包围的文字的重要性。

// 章节序号不重要,章节的名字才重要
<h1>Chapter 1: <strong>The Praxis</strong></h1>
严重性

<strong> 元素可以被用来标记警告或者警示标志。

<p><strong>Warning.</strong> This dungeon is dangerous.</p>
紧急性

<strong> 元素可以被用来表示需要被尽快看见的部分。需要注意的是,<strong> 元素仅仅对文本内容的重要性、严重性或紧急性产生作用,而不像 <em> 对句子含义进行改变。

<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>

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值