Stack Overflow、もう一度助けを求めてあなたのところに来ます。今回は、自分のサイトのメインコンテンツの見出しに関するHTML5のセマンティクスを理解するのに苦労しています。以下は2つの例ですが、どちらを使用すればよいですか?おそらく私は完全に別の方法で行く必要がありますか?
編集:コード例を混同しました!
例1
このコードを使用すると、次のようなアウトラインが得られます。
- カテゴリ:foo
- ブログ投稿#1
- ブログ投稿#2
ブログの投稿はカテゴリの下に投稿されているので、どちらが間違っているように見えますか?
<header id="header">
<h1>My awesome website!</h1>
<!-- Primary navigation and such -->
</header>
<div id="content">
<section id="title">
<h1>Category: foo</h1>
<p>Some content</p>
</section>
<article>
<h1>Blog post #1</h1>
<p>Some content</p>
</article>
<article>
<h1>Blog post #2</h1>
<p>Some content</p>
</article>
</div>
例2
このコードを使用すると、次のようなアウトラインが得られます。
- カテゴリ:foo
- ブログ投稿#1
- ブログ投稿#2
これは私には正しいように思えますが、HTML5 Doctor<section>
は、メイン/プライマリコンテンツラッパーとして使用すべきではないと述べています。
また、この例を使用する場合、メインコンテンツ(すべての投稿が表示されるインデックスページなど)に自然な見出しがない場合は、と交換<section id="content>
しますか?<div id="content">
<header id="header">
<h1>My awesome website!</h1>
<!-- Primary navigation and such -->
</header>
<section id="content">
<header id="title">
<h1>Category: foo</h1>
<p>Some content</p>
</header>
<article>
<h1>Blog post #1</h1>
<p>Some content</p>
</article>
<article>
<h1>Blog post #2</h1>
<p>Some content</p>
</article>
</section>