TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
长久以来,我们习惯于使用<div id="footer">这样的代码作为页面的页脚。在HTML5中,我们可以 使用用途更广、扩展性更强的<footer>元素了。根据W3C的定义规范:
[blockquote]
footer元素可以作为其直接父级内容区块或是一个根区块的结尾。footer通常包括其相关区块的附加信息,如作者、相关阅读链接以及版权信息 等。
The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
[/blockquote] 怎样使用<footer>元素?
目前,我们通常使用类似下面这样的代码来写页面的页脚:
<div id="footer">
<ul>
<li>copyright</li>
<li>sitemap</li>
<li>contact</li>
<li>to top</li>
</ul>
<div>[/code]
在HTML5中,我们可以不使用div,而用更加语义化的footer来写:
<footer>
<ul>
<li>copyright</li>
<li>sitemap</li>
<li>contact</li>
<li>to top</li>
</ul>
</footer>[/code]
在同一个页面中可以使用多个<footer>元素,即可以用作页面整体的页脚,也可以作为一个内容区块的结尾,例如,我们可以 将<footer>直接写在<section>或是<article>中:
<section>
Section content appears here.
<footer>
Footer information for section.
</footer>
</section>[/code]
<article>
Article content appears here.
<footer>
Footer information for article.
</footer>
</article>[/code]
jcomments.setAntiCache(1,0,0);
|
|