你不能一般回答这个例子,它取决于页面的内容。
这里重要的是你的页面大纲。因此,您可以忽略所有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