为什么HTML 5仍然支持演示元素?
请参阅此处的列表:
http://www.w3schools.com/html5/html5_reference.asp
如< b>
,< i>
,< br>
,< hr>
,< small>
?
使用这些是否意味着没有利弊?但内容和演示分离呢?
Is it means no cons to use these? But what about content and presentation seperation?
有两个原因可以理解:
-
因为有些人(不是我,这里有关于这个意见的入门书和这里是WHATWG常见问题解答)不要认为它们是表现性的。他们认为,
< b>
具有自己的语义,例如,< strong>
不是是的,文本应该是粗体的(恕我直言,因此我们有< span>
)
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>
)
因为HTML5具有实用且向后兼容的方法:HTML4中的工作原理也适用于HTML5。他们认为,这就是XHTML2死亡的原因。
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.