<section>
标签和 <div>
标签都可以对内容进行分块,其中 <section>
标签是有意义的分块, <div>
标签是无意义的分块。
<section>
元素表示文档中一个章节,一般会包含一个标题,例如:
<h1>Choosing an Apple</h1>
<section>
<h2>Introduction</h2>
<p>This document provides a guide to help with the important task of choosing the correct Apple.</p>
</section>
<section>
<h2>Criteria</h2>
<p>There are many different criteria to be considered when choosing an Apple — size, color, firmness, sweetness, tartness...</p>
</section>
而 <div>
元素是一个通用的内容容器,并无实际意义,例如:
<div>
<p>这是一段内容</p>
</div>
<div>
<img src="/media/examples/leopard.jpg"
alt="这是一张图片">
<p>这是一段内容</p>
</div>