[英]HTML5 <section>'s inside <article> and header
我正在嘗試制作語義HTML5代碼,但不確定它是否正確。 Visualy我有一篇文章/帖子分為3個小冊子:
圖像 (200像素)| H1 +摘要+更多鏈接 (350px)| 附加部分有2個標題H2 (150px)
在CSS中我會浮動: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>
哪一個是對的?
取決於你想要什么..
div - 我們都知道和喜愛的“通用流量容器”。 它是一個塊級元素,沒有額外的語義含義。
部分 - “通用文件或申請部分”。 一節通常有標題(標題),也可能是頁腳。 它是一大塊相關內容,如長文章的子部分,頁面的主要部分(例如主頁上的新聞部分),或webapp標簽界面中的頁面。
http://boblet.tumblr.com/post/130610820/html5-structure1 文章鏈接
我會這樣使用它( 你的v2 ):
<div> <!-- Main article div -->
<article> <!-- First article -->
<section><!-- Header, about the author... --></section>
<section><!-- related info .. --></section>
<section><!-- conclusion --></section>
</article>
<article>
<section></section>
<section></section>
<section></section>
</article>
</div>
這不對......他們兩個,也是答案......不要使用DIV! 使用部分INSTEAD!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.