你不能一般回答這個例子,它取決於頁面的內容。
這裏重要的是你的頁面大綱。因此,您可以忽略所有div
元素,因爲它們不影響大綱。如果你需要需要作爲CSS或JavaScript的鉤子,請使用它們。
第一個問題會是:aside
與整個頁面有關還是與「內容區」有關?如果它與整個頁面有關,則不得包含包含在另一個分段元素中。如果它與內容區域有關,則已將包括在該區段元素中。這裏我假定它與整個網頁有關。
該第二個問題:有三個article
元素的共同標題?例如:「我最喜歡的書」,「最新的博客文章」或「產品」。如果是這樣,您應該使用將這三個article
元素分組的元素。如果沒有可能的標題,那麼您可能不希望在此處使用切片元素,因此可以使用div
或根本不使用元素。
的第三個問題(如果第二個問題得到的回答正):應此切片元件是section
或article
元件?如果您對這三個「東西」使用article
元素的選擇是正確的,那麼可能是(但不是!)在這裏需要section
。再次使用article
是否正確,取決於實際內容。因此,它可以是可能是您更希望的
<article>
<section></section>
<section></section>
<section></section>
</article>
代替
<section>
<article></article>
<article></article>
<article></article>
</section>
在這裏,我假設你使用article
三個「東西」的選擇是正確的。
所以最終版本可能看起來像:
<header>
<!-- if this header applies to the whole page -->
</header>
<section>
<!-- a h1 like "Latest blog posts" -->
<article>
content
</article>
<article>
content
</article>
<article>
content
</article>
</section>
<aside>
<!-- if this aside applies to the whole page -->
<aside>
<footer>
<!-- if this footer applies to the whole page -->
</footer>
有在http://www.html5accessibility.com/tests/maincontent.html一個''元素的新提案。例如,請參見http://www.brucelawson.co.uk/2012/scooby-doo-content-element/。即使它通過了,它也不會成爲HTML5的一部分,而是HTML5的一部分。同時,按照Matt Whipple的建議使用'role =「main」'。 –
Alohci