引进于 HTML5
概要
HTML Section 元素 (<section>) 表示文档中的一个区域(或节),比如,内容中的一个专题组,一般来说会有包含一个标题(heading)。一般通过是否包含一个标题 (<h1>-<h6> element) 作为子节点 来 辨识每一个<section>。
使用提醒:
使用场景
| 合法内容 | Flow content |
| 标签省略 | 无,开始标签和结束标签都不可省略 |
| 合法父元素 |
任何接受 flow content 的元素。注意. 一个 |
| DOM接口 | HTMLElement |
属性(Attributes)
此元素只包含 全局属性(the global attributes).
范例1:
<section> <h1>Heading</h1> <p>Bunch of awesome content</p> </section>
范例2:
之前
<div>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</div>
之后
<section>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</section>
详述:
| Specification | Status | Comments |
|---|---|---|
| WHATWG HTML Living Standard <section> |
Living Standard | |
| HTML5.1 <section> |
Working Draft | |
| HTML5 <section> |
Recommendation |
浏览器兼容性
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 5 | 4.0 (2.0) | 9.0 | 11.10 | 4.1 |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | 2.2 | 4.0 (2.0) | 9.0 | 11.0 | 5.0 (iOS 4.2) |