我发现了许多关于HTML5最佳实践的相互矛盾的信息,我想知道我的文章结构是否正确。一般而言,此站点上的页面将由带有导航、文章和页脚的页眉组成。
这是我的基本结构:
<body>
<header>Header content
<nav>Navigation</nav>
</header>
<article>
<header>
<h1>Beans, beans</h1> <!--Main title for article-->
<h2>Good for your heart?</h2> <!--Subtitle for article-->
</header>
<section>
<header>
<h3>Legume-based Flatulence</h3> <!--Section title-->
</header>
<p>Lorem ipsum beans beans beans.</p>
</section>
<section>
<header>
<h3>Gas and Good Feelings</h3>
</header>
<p>Correlation does not imply causation.</p>
<footer> <!--Section footer for sources or...?-->
Source: Phenomenological Farts, a Study in Siena
</footer>
</section>
<section>
<header>
<h3>Beans for Every Meal?</h3>
</header>
<p>This is probably a terrible idea.</p>
</section>
<footer> <!--Article footer for additional downloads, etc-->
<a href="#">Download this article!</a>
</footer>
</article>
<footer>
Footer content.
</footer>
</body>这有意义吗?在文章的章节中使用页眉和页脚可以吗?
发布于 2014-08-21 11:43:36
当你不确定哪些标签允许在其他标签中使用时,只需在w3.org上查看规范。或者通过validator运行您的代码。The spec声明section、header和article标签可以在任何允许flow elements的容器中使用。因此,到目前为止,您所拥有的是有效的。
发布于 2014-08-21 11:54:57
我本打算推荐使用http://www.webmonkey.com/2013/04/w3c-drops-hgroup-tag-from-html5-spec/对报头进行分组,但现在不再推荐了。也许可以使用header来代替它。来自W3C的更多信息和建议:http://www.w3.org/html/wg/drafts/html/master/common-idioms.html#sub-head
然后,我还会将其他h3更改为h2s,因为它们是节标题。
最后,由hx组成的header soley是一种冗余。
有关Headers和Footers的更多信息
https://stackoverflow.com/questions/25409771
复制相似问题