我做了一些研究,但没有找到合适的答案。我想知道是继续使用 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/