我正在尝试制作语义化的HTML5代码,但不确定是否正确。视觉上,我有一篇文章/帖子分成3列:
图片(200像素)| H1+摘要+更多链接(350像素)| 附加部分,包含2个标题H2(150像素)
在CSS中,我会使用float:left - figure,.post-summary,.post-aside。
这是Ver.1:
在CSS中,我会使用float:left - figure,.post-summary,.post-aside。
这是Ver.1:
<article>
<figure>
<a href="#"><img src="images/temp/entry_01.jpg" alt=""></a>
<figcaption>Title for Case Study</figcaption>
</figure>
<div class="post-summary">
<section>
<h1>MAIN Article Title</h1>
<p>Lorem ipsum...</p>
<a href="#">read more</a>
</section>
</div>
<div class="post-aside">
<section>
<h2>The Charges:</h2>
<p>Lorem ipsum...</p>
</section>
<section>
<h2>The Verdict:</h2>
<p>Lorem ipsum...</p>
</section>
</div>
</article>
版本2
<article>
<figure>
<a href="#"><img src="images/temp/entry_01.jpg" alt=""></a>
<figcaption>Title for Case Study</figcaption>
</figure>
<section class="post-summary">
<h1>MAIN Article Title</h1>
<p>Lorem ipsum...</p>
<a href="#">read more</a>
</section>
<section class="post-aside">
<h2>The Charges:</h2>
<p>Lorem ipsum text ...</p>
<h2>The Verdict:</h2>
<p>Lorem ipsum text...</p>
</section>
</article>
哪一个是正确的?
<h1>
应该作为<article>
的DOM中的第一级,以成为文章中最重要的标题。 - SerNeo