使用HTML5,将<article>元素放在<li>元素中是否在语义上是正确的.这将证明有用的情况是博客上的近期或热门文章的列表.考虑以下:
<section id="popular">
<div class="blurb">
<h2>Popular Articles</h2>
<p>The most popular posts from my blog.</p>
</div>
<ul>
<li>
<article>
<h3>Article</h3>
<p>An excerpt from the article.</p>
</article>
</li>
<li>
<article>
<h3>Article</h3>
<p>An excerpt from the article.</p>
</article>
</li>
<li>
<article>
<h3>Article</h3>
<p>An excerpt from the article.</p>
</article>
</li>
</ul>
</section>
Run Code Online (Sandbox Code Playgroud)
如下所示:
我博客上最受欢迎的帖子.
摘自文章.
摘自文章.
摘自文章.
对我而言,这似乎是标记信息的绝佳方式.我唯一的问题是以这种方式<article>将<li>元素嵌套在元素中是否正确.