可以通过这种方式使用html5页脚吗?

时间:2012-02-05 23:49:57

标签: html5 markup

我正在设计一个博客,这是我正在使用的标记 - 只显示文章摘要,我确信其余的

<article>
    <header>
        <h2>this is the posts title</h2>
        <footer>
           <p>by aurel kurtula on <time>21:21pm</time></p> <ul><li>tag1</li><li>tag2</li><li>tag3</li></ul>
        <footer>
     <section>Here is the body of the article</section>
</article>

所以我的问题是我应该以这种方式使用页脚吗?我假设<section>适用于文章正文,或者是它?

由于

1 个答案:

答案 0 :(得分:3)

我想说你的结构很好,只要你关闭了header标签,你在示例代码中似乎没有这样做。时间:

  

标题元素通常包含节的标题   (h1-h6元素或hgroup元素)

您应该在header之后关闭h2

<article>
    <header>
        <h2>this is the posts title</h2>
    </header>
    <footer>
       <p>by aurel kurtula on <time>21:21pm</time></p> <ul><li>tag1</li><li>tag2</li><li>tag3</li></ul>
    <footer>
    <section>Here is the body of the article</section>
</article>

article的中间使用名为footer的元素似乎很奇怪,但这并没有错:

  

页脚元素代表其最近祖先的页脚   分割内容或分割根元素。通常是一个页脚   包含有关其部分的信息,例如谁写了它,链接到   相关文件,版权数据等。

     

...

     

页脚不一定要出现在某个部分的末尾,   虽然他们通常会这样做。

这意味着有问题的footer应该适用于article元素,而不是section。例如,如果每个section有多个article元素,并且每个元素都需要单独的footer,那么这些footer元素可能应该显示为各自{{1}的后代}}

相关问题