<b> 和 <b> 有什么区别?和 <strong>, <i>和<em>?

2022-01-30 00:00:00 html xhtml

<b><strong><i>有什么区别? 在 HTML/XHTML 中?你应该什么时候使用它们?

What's the difference between <b> and <strong>, <i> and <em> in HTML/XHTML? When should you use each?

推荐答案

它们在普通浏览器渲染引擎上效果相同,但有根本区别他们.

正如作者在 讨论列表帖子:

考虑三种不同的情况:

  • 网络浏览器
  • 盲人
  • 手机

Bold"是一种风格——当你说bold a word"时,人们基本上都知道这意味着在字母周围添加更多,比如说墨水",直到它们脱颖而出在其余的字母中更多.

"Bold" is a style - when you say "bold a word", people basically know that it means to add more, let's say "ink", around the letters until they stand out more amongst the rest of the letters.

不幸的是,这对盲人来说毫无意义.在手机上和其他 PDA 一样,文本已经是粗体了,因为屏幕分辨率非常小.如果不搞砸的话,你不能加粗.

That, unfortunately, means nothing to a blind person. On mobile phones and other PDAs, text is already bold because screen resolution is very small. You can't bold a bold without screwing something up.

<b> 是一种风格 - 我们知道粗体"应该是什么样子.

<b> is a style - we know what "bold" is supposed to look like.

<strong> 但是表示应该如何理解某事.强"在浏览器中可能(并且经常)意味着粗体",但它也可能意味着像 Jaws(盲人)这样的口语程序的语气较低或用下划线表示(因为你不能加粗粗体)在 Palm Pilot 上.

<strong> however is an indication of how something should be understood. "Strong" could (and often does) mean "bold" in a browser, but it could also mean a lower tone for a speaking program like Jaws (for blind people) or be represented by an underline (since you can't bold a bold) on a Palm Pilot.

HTML 从来就不是关于样式的.做 一些搜索 Tim Berners-Lee" 和 语义网". <strong>是语义化的——它描述了它所包围的文本(例如,这个文本应该比你显示的其他文本更强大"),而不是描述如何它周围的文本应显示(例如,此文本应为粗体").

HTML was never meant to be about styles. Do some searches for "Tim Berners-Lee" and "the semantic web." <strong> is semantic—it describes the text it surrounds (e.g., "this text should be stronger than the rest of the text you've displayed") as opposed to describing how the text it surrounds should be displayed (e.g., "this text should be bold").

相关文章