嵌入HTML5部分标签

这是否正确使用< section>标签
<section id="container">
   <section id="outer">
      <section id="inner">
      </section>
   </section>
</section>

我试图找出我是否只应该使用一个部分ID,并将其他两个部分作为只是div?

解决方法

如果您只是使用这些元素来放置某些位置/风格的东西,那么您应该使用div。

部分是真正的分组属于一起的内容 – 你不应该有一个没有标题(H1或类似)的部分描述该部分包含的部分…有几个人在过去犯了类似的错误我认为:

http://html5doctor.com/the-section-element/

从规格:

NOTE: The section element is not a generic container element. When an
element is needed for styling purposes or as a convenience for
scripting,authors are encouraged to use the div element instead. A
general rule is that the section element is appropriate only if the
element’s contents would be listed explicitly in the document’s
outline.

话虽如此,嵌套截面元素是完全可以接受的。也许像:

<section>
    <h1>Portishead</h1>
    <p>Portishead are a cool band from Bristol</p>
    <section>
        <h1>Dummy (album)</h1>
        <p>some info....</p>
        <img src="..." />
    </section>
    <section>
        <h1>Portishead (album)</h1>
        <p>some other info info....</p>
        <img src="..." />
    </section>
</section>

相关文章

HTML5和CSS3实现3D展示商品信息的代码
利用HTML5中的Canvas绘制笑脸的代码
Html5剪切板功能的实现
如何通过HTML5触摸事件实现移动端简易进度条
Html5移动端获奖无缝滚动动画实现
关于HTML5和CSS3实现机器猫的代码