我在两栏中写指南。是否在div中放置部分是一种很好的做法。
<div class="col-md-6">
<section>
<h5>Heading 1</h5>
<p>Paragraph 1</p>
</section><!-- Content 1 -->
<section>
<h5>Heading 2</h5>
<p>Paragraph 2</p>
</section><!-- Content 2 -->
</div>
提前致谢。
答案 0 :(得分:1)
<div>
标记是通常用于样式的通用标记,如在示例中的Bootstrap中。您可以执行类似这样的操作,以获得更符合语义的HTML5:
<article class="col-md-6">
<section>
<h5>Heading 1</h5>
<p>Paragraph 1</p>
</section><!-- Content 1 -->
<section>
<h5>Heading 2</h5>
<p>Paragraph 2</p>
</section><!-- Content 2 -->
</article>
或将div
保留在您的标记中,只需将初始代码放在article
标记中,其中div
将用于样式目的:
<article>
<div class="col-md-6">
<section>
<h5>Heading 1</h5>
<p>Paragraph 1</p>
</section><!-- Content 1 -->
<section>
<h5>Heading 2</h5>
<p>Paragraph 2</p>
</section><!-- Content 2 -->
</div>
</article>
答案 1 :(得分:-1)
我认为更好的方法是使用section而不是div然后使用article而不是
部分<section class="col-md-6">
<article>
<h5>Heading 1</h5>
<p>Paragraph 1</p>
</article><!-- Content 1 -->
<article>
<h5>Heading 2</h5>
<p>Paragraph 2</p>
</article><!-- Content 2 -->
</section>