【问题标题】:Is it ok to have section tag within footer tag in HTML5?可以在 HTML5 的页脚标签中使用 section 标签吗?
【发布时间】:2014-09-20 04:02:43
【问题描述】:

我是 HTML5 标记的新手。

我想知道是否允许我在页脚中有一个部分标记,如下所示。

<article>
    <header class="content__header">
    </header>

    <section class="content__body">
    </section>

    <footer class="content__footer>
        <section class="relatedArticles">
        </section>
        <section class="pagination">
        </section>
    </footer>

</article>

w3c 文档没有过多解释页脚标签的使用。

谢谢!!

【问题讨论】:

  • 简单地说,是的。完全有效的 HTML5。
  • 根据rfc 部分是有效的,其中flow content 是预期的。所以它是完全有效的。
  • “w3c 文档没有对页脚标签的使用做出太多解释。”你确定吗?我看到很多例子here

标签: html


【解决方案1】:

w3c 文档没有过多解释页脚标签的使用。

...事实上,确实如此。第 4.3.8 节 &lt;footer&gt; ( http://www.w3.org/TR/html5/sections.html#the-footer-element ) 声明:

内容模型:Flow content,但没有页眉、页脚或主要元素后代。

The section of the specifiction defining "Flow content" (3.2.4.1.2) lists all "flow" elements,其中列出了&lt;section&gt;

因此,您的 HTML 是有效的:&lt;section&gt; 可以是 &lt;footer&gt; 的后代,但 &lt;header&gt;&lt;footer&gt;&lt;main&gt; 不能。

【讨论】:

    猜你喜欢
    • 2014-12-23
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 2011-11-03
    • 2012-12-30
    相关资源
    最近更新 更多