小编Ang*_*ell的帖子

在<li>元素中嵌套<article>元素在语义上是否正确?

使用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>元素嵌套在元素中是否正确.

html5 semantic-web semantic-markup

14
推荐指数
1
解决办法
5948
查看次数

标签 统计

html5 ×1

semantic-markup ×1

semantic-web ×1