html - 对于使用语义 HTML 的评论列表,我应该使用 <ol>、<ul>、<article> 还是 <blockquote>?

标签 html semantic-web semantic-markup

我做了一些研究,但没有找到合适的答案。我想知道是继续使用 li 元素作为评论列表还是改用 article 元素更好?

示例 1:

<ol class="comment-list">
  <li class="comment">
    <figure class="avatar">
      <img ... >
    </figure>
    <span class="author">Linus Torvalds</span>
    <p class="comment-text">
      Linux is awesome!
    </p>
  </li>
  ...
</ol>

示例 2:

<div class="comment-list">
  <article class="comment">
    <header>
      <figure class="avatar">
        <img ... >
      </figure>
    </header>
    <span class="author">Linus Torvalds</span>
    <p class="comment-text">
      Linux is awesome!
    </p>
  </article>
  ...
</div>

什么是最好的解决方案?

更新 1

示例 3(更好的示例):

<main>
  <article>

    <header>
      <h1>Text title</h1>
    </header>

    <p>The text...</p>

    <section class="comment-list">
      <article class="comment">
        <header>
          <figure class="avatar">
            <img ... >
          </figure>
        </header>
        <span class="author">Linus Torvalds</span>
        <p class="comment-text">
          Linux is awesome!
        </p>
      </article>
      <article class="comment">
        <header>
          <figure class="avatar">
            <img ... >
          </figure>
        </header>
        <span class="author">Richard Stallman</span>
        <p class="comment-text">
          GNU is awesome!
        </p>
      </article>
      ...
    </section>

  </article>
</main>

最佳答案

如果您想提供比使用 ol 更多的语义值/ul , 然后 article在我看来,这将是最佳选择。

关于blockquote来自 w3schools :

The <blockquote> tag specifies a section that is quoted from another source.

我会说“从其他来源引用”并不真正适用于评论。

关于article来自 w3schools :

The <article> tag specifies independent, self-contained content. An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.

所有这些要点可能都适用于您的评论,所以我建议您使用 <article> .

关于html - 对于使用语义 HTML 的评论列表,我应该使用 <ol>、<ul>、<article> 还是 <blockquote>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51275226/

相关文章:

rdf - rdf链接和普通链接的区别

html - 当每行写一个句子并且希望行与行之间有空格但只有一个语义段落时,我应该使用 <br> 还是 <p> ?

html - <nav> 标签应该在 <main> 标签之外吗?

html - 自定义字体未在IE中加载

javascript - 如果类存在则将类添加到嵌套 div,如果类不存在则将类添加到所有嵌套 div?

user-interface - 基于 Web 的 RDF 三元组编辑器? (如 RDB 的 phpMyAdmin)

namespaces - 如何使用 Jena 向 OntClass 添加远程命名空间

html - 如何将 GSS 文件导入 GWT HTML 文件

javascript - React/Nextjs - 知道什么页面在 _app.js 上呈现

html - 在摘要标签内使用 h2 标签在语义上是否正确?