我想知道结合使用HTML5和div
标签的最佳方法。 我已经在下面发布了我的html。
我正在使用article
标签,然后我确定部分是正确的,但是我也在使用网格,因此应该将grid div
放在哪里?
我的方法是最好的方法吗?
<article>
<div class="grid-wrapper">
<section>
<div class="grid-4-col">
<h1>Welcome Back</h1>
<p>It has been a while. What have you been up to lately?</p>
</div>
</section>
<section>
<div class="grid-4-col">
<h1>Welcome Back</h1>
<p>It has been a while. What have you been up to lately?</p>
</div>
</section>
<section>
<div class="grid-4-col">
<h1>Welcome Back</h1>
<p>It has been a while. What have you been up to lately?</p>
</div>
</section>
<section>
<div class="grid-4-col grid-last">
<h3>Chicago</h3>
<h5 hidden>City in Illinois</h5>
<img src="chicago.jpg" alt="Chicago, the third most populous city in the United States">
<ul>
<li>234 square miles</li>
<li>2.715 million residents</li>
</ul>
</div>
</section>
</div>
</article>
根据HTML5Doctor的说法,此方法很好。 您可以有效地将div用作包装器,这是允许的。
由于您使用的是网格系统,并且section元素将内容分割开,因此您希望该部分位于div定义的网格内。 因此,将section元素放入div中。 否则,您的网格相对于该部分,而不是整个页面和网格系统。