TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
<article>是HTML5中的新元素标签,根据 W3C的定义规范:
[blockquote]
article元素用来在页面中表示一套结构完整且独立的内容部分。article可以用来呈现论坛的一个帖子,杂志或报纸中的一篇文章,一篇博客,用户提交的评论内容
,可互动的页面模块挂件等。
[/blockquote] <article>是可以嵌套使用的,内层的内容在原则上需要与外层内容相关联。例如,一篇博客文章与针对该文章的评论就可以使用嵌 套<article>的方式;用来呈现评论的<article>元素被包含在文章内容的<article>里面。 以“博客”为例子,我们来看两个代码实例。首先,对于文章列表页面中的每一篇日 志,可以使用如下形式的代码:
<article>
<header>
<h1>The Very First Rule of Life</h1>
<p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
</header>
<p>If there"s a microphone anywhere near you, assume it"s hot and
sending whatever you"re saying to the world. Seriously.</p>
<p>...</p>
<footer>
<a href="?comments=1">Show comments...</a>
</footer>
</article>[/code]
然后是文章内页的代码范例;其中包括文章及用户评论:
<article>
<header>
<h1>The Very First Rule of Life</h1>
<p><time pubdate datetime="2009-10-09T14:28-08:00"></time></p>
</header>
<p>If there"s a microphone anywhere near you, assume it"s hot and
sending whatever you"re saying to the world. Seriously.</p>
<p>...</p>
<section>
<h1>Comments</h1>
<article>
<header>
<p>Posted by: George Washington</p>
<p><time pubdate datetime="2009-10-10T19:10-08:00"></time></p>
</header>
<p>Yeah! Especially when talking about your lobbyist friends!</p>
</article>
<article>
<header>
<p>Posted by: George Hammond</p>
<p><time pubdate datetime="2009-10-10T19:15-08:00"></time></p>
</header>
<p>Hey, you have the same first name as me.</p>
</article>
</section>
</article>[/code]
|
|