HTML5中的内部标题或之前的标题之间的区别 [英] Difference between heading inside section or before it in HTML5

查看:117
本文介绍了HTML5中的内部标题或之前的标题之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML5中,具有h eading作为子元素的section和作为h eading元素的下一个同级项的section有什么区别?对于div元素而不是section,是否具有相同的区别?

In HTML5, what is the difference between a section with a heading as child element and a section which is the next sibling of a heading element? Does the same difference hold for div elements instead of section?

<section>
<h1>First section</h1>
<!-- other content -->
</section>

<!-- vs. -->

<h1>Second section</h1>
<section>
<!-- other content -->
</section>

推荐答案

最大和最重要的区别是大纲算法将如何解析html页面.由于标题元素无法标记与之相关的部分的结尾;他们也不能嵌套. <section>元素可以嵌套,因此可以正确标记文档的轮廓.

The biggest and most important difference is how outlining algorithms will parse the html page. Since heading elements offer no way to mark the end of the section they relate to; they they cannot nest either. <section> elements can be nested, and thus allow to properly markup a document's outline.

smashing杂志详细说明了它们如何工作以及如何以及应该如何使用,它们还提供了示例和常见的陷阱.

smashing magazine has a detailed explanation of how it works and how it can and should be used, they also provide examples and common pitfalls.

这篇关于HTML5中的内部标题或之前的标题之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆