为什么 HTML 5 仍然支持展示元素?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想到两个原因:
因为有些人(不是我,这里是关于此观点的入门 和 这里是 WHATWG 常见问题解答)不要将它们视为演示性的。他们认为,
有自己的语义,例如,
不正确并且文本无论如何都应该是粗体(恕我直言,因此我们有
)
因为 HTML5 具有实用且向后兼容的方法:在 HTML4 中有效的内容也应该在 HTML5 中有效。他们认为,这就是 XHTML2 消亡的原因。
Two reasons come to mind:
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>
)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.
首先看看WHATWG说了一下(上面引用的相关问题的答案中也提到了这一点)。
据说(正如我所想的那样) ; 和 使用屏幕阅读器时提供强调,但根据 Harry Roberts 的这篇文章,事实证明,在实践中,屏幕阅读器不会强调以这种方式标记的文本。
最后,阅读有关 (上面第一个链接的常见问题解答中已经提到了):
和 :
同样,请查看 、
和
(那里也有例子。)
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):
and <i>:
Likewise, have a look at <small>, <hr> and <br> (there are examples there, too.)
他们还重新定义了其中几个元素的含义和语义。他们意识到需要一个执行
之类的元素,并且已经有一个元素,因此他们保留了它,并保留了向后兼容性,而不是引入新的东西。
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.