为什么 HTML 5 仍然支持展示元素?

发布于 2024-08-20 17:21:13 字数 333 浏览 10 评论 0原文

请参阅此处的列表:

http://www.w3schools.com/html5/html5_reference.asp



<小>

使用这些是否意味着没有缺点?但是内容和呈现的分离又如何呢?

See list here:

http://www.w3schools.com/html5/html5_reference.asp

like <b> , <i>, <br>, <hr>, <small>?

Is it means no cons to use these? But what about content and presentation seperation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

错爱 2024-08-27 17:21:13

我想到两个原因:

  1. 因为有些人(不是我,这里是关于此观点的入门这里是 WHATWG 常见问题解答)不要将它们视为演示性的。他们认为, 有自己的语义,例如, 不正确并且文本无论如何都应该是粗体(恕我直言,因此我们有 )

  2. 因为 HTML5 具有实用且向后兼容的方法:在 HTML4 中有效的内容也应该在 HTML5 中有效。他们认为,这就是 XHTML2 消亡的原因。

Two reasons come to mind:

  1. Because some people (not me, here is a primer about this opinion and here are the WHATWG FAQ about this) don't think of them as presentational. They argue, that <b> has semantics of its own, for example, where <strong> is not right and the text should be bold anyways (IMHO therefore we have <span>)

  2. Because HTML5 has a pragmatic and backwards compatible approach: What worked in HTML4 should work too in HTML5. They argue, that this is why XHTML2 died.

情痴 2024-08-27 17:21:13

首先看看WHATWG说了一下(上面引用的相关问题的答案中也提到了这一点)。

据说(正如我所想的那样) ;使用屏幕阅读器时提供强调,但根据 Harry Roberts 的这篇文章,事实证明,在实践中,屏幕阅读器不会强调以这种方式标记的文本。

最后,阅读有关 (上面第一个链接的常见问题解答中已经提到了):

b 元素代表一个跨度
风格上偏移的文本
普通的散文,不传达任何信息
特别重要,例如关键词
文档摘要、产品名称
评论或其他文本范围
典型的印刷呈现是
加粗。

第 i 个元素代表一个跨度
以不同的声音或语气发送文字,或者
否则偏离正常值
散文,例如分类学
名称、技术术语、
别人的惯用语
语言、想法、船名,或者
其他一些散文的典型
排版呈现方式是
斜体。

同样,请查看



(那里也有例子。)

First have a look what WHATWG says about it (this is also mentioned in the answer to the related question cited above).

It is said (as I thought, too) that <strong> and <em> provide an emphasis when using a screen reader, but according to this article by Harry Roberts, it turns out that in practice screen readers don't accentuate text marked this way.

And last, read the spec about <b> (it's already mentioned in the FAQ in the first link, above):

The b element represents a span of
text to be stylistically offset from
the normal prose without conveying any
extra importance, such as key words in
a document abstract, product names in
a review, or other spans of text whose
typical typographic presentation is
boldened.

and <i>:

The i element represents a span of
text in an alternate voice or mood, or
otherwise offset from the normal
prose, such as a taxonomic
designation, a technical term, an
idiomatic phrase from another
language, a thought, a ship name, or
some other prose whose typical
typographic presentation is
italicized.

Likewise, have a look at <small>, <hr> and <br> (there are examples there, too.)

故事和酒 2024-08-27 17:21:13

他们还重新定义了其中几个元素的含义和语义。他们意识到需要一个执行 之类的元素,并且已经有一个元素,因此他们保留了它,并保留了向后兼容性,而不是引入新的东西。

They have also redefined the meaning and semantics of several of these elements. They realized the need for an element that does something like <b> and there was already an element, so they kept it, and preserved backwards compatibility, instead of introducing something new.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文