主体结构元素
article 元素
代表文档或页面,应用程序中独立的,完整的,可以独自被外部引用的内容。 可以是文章,帖子,评论,或其他独立的内容 有自己的标题 可以嵌套使用
article可以看做特殊类型的section元素,比section更强调独立性
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Document</title><style>.forecast {margin: 0;padding: 0.3rem;background-color: #eee;font: 1rem "Fira Sans", sans-serif;}.forecast > h1,.day-forecast {margin: 0.5rem;padding: 0.3rem;font-size: 1.2rem;}.day-forecast {background: right/contain content-box border-box no-repeaturl("/media/examples/rain.svg") white;}.day-forecast > h2,.day-forecast > p {margin: 0.2rem;font-size: 1rem;}</style></head><body><article class="forecast"><h1>Weather forecast for Seattle</h1><article class="day-forecast"><h2>03 March 2018</h2><p>Rain.</p></article><article class="day-forecast"><h2>04 March 2018</h2><p>Periods of rain.</p></article><article class="day-forecast"><h2>05 March 2018</h2><p>Heavy rain.</p></article></article></body></html>
section 元素
用于对网站或应用程序中页面上的内容进行分块 section 中的内容可以单独储存到数据库中或输出到Word文档中
- 不要将section元素用作设置样式的页面容器,这是div元素的工作
- 如果article元素,aside元素或nav更符合使用条件,不要使用section元素
- 不要为没有标题的内容区块使用section元素
nav 元素
一个用作页面导航的链接组 可用于
- 传统导航栏,作用是将当前页面跳转到其他页面上去
- 侧边导航栏,作用同上
- 页内导航
