问题描述
<header>
// logo
// Site navigation
</header>
<main>
<article>
<section>
// Hero image or video block
</section>
<section>
// Here all kinds of paragraphs are rendered (e.g: Call to action,related video's block to this page,related actors block related to this page etc.
// All those blocks has their own <section> tag
</section>
</article>
</main>
所以在上面的例子中,在 <article>
中我有 2 个 <section>
标签,然后在第二个 <section>
中我有更多的 <section>
标签嵌套。这是正确的做法吗?
解决方法
通常,article
标记将用于博客页面,用于一个页面上多篇博客文章的集合(即包含多个 <article>
标记),或用于单个文章页面(即包含一个 <article>
标签)。无论如何,一篇文章应该在主题上独立存在,它的理解不依赖于文章标签之外的任何其他内容。
<section>
类似,但用于涵盖特定页面(也在文章内)处理的一般主题的多个方面。在某些情况下,这两者可以互换,但通常从字面上解释“文章”一词可以帮助 IMO。