小编Art*_*újo的帖子

我应该使用 <ol>、<ul>、<article> 或 <blockquote> 来使用语义 HTML 来列出评论吗?

我做了一些研究,但没有找到合适的答案。我\xe2\x80\x99m 想知道\xe2\x80\x99 是否最好继续使用 li 元素作为评论列表,或者切换到 Article 元素?

\n\n

示例1:

\n\n
<ol class="comment-list">\n  <li class="comment">\n    <figure class="avatar">\n      <img ... >\n    </figure>\n    <span class="author">Linus Torvalds</span>\n    <p class="comment-text">\n      Linux is awesome!\n    </p>\n  </li>\n  ...\n</ol>\n
Run Code Online (Sandbox Code Playgroud)\n\n

示例2:

\n\n
<div class="comment-list">\n  <article class="comment">\n    <header>\n      <figure class="avatar">\n        <img ... >\n      </figure>\n    </header>\n    <span class="author">Linus Torvalds</span>\n    <p class="comment-text">\n      Linux is awesome!\n    </p>\n  </article>\n  ...\n</div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

最好的解决方案是什么?

\n\n

更新1

\n\n

示例 3(更好的示例):

\n\n
<main>\n  <article>\n\n    <header>\n      <h1>Text title</h1>\n    </header>\n\n    <p>The text...</p>\n\n    <section class="comment-list">\n      <article class="comment">\n        <header>\n          <figure class="avatar">\n …
Run Code Online (Sandbox Code Playgroud)

html semantic-web semantic-markup

3
推荐指数
1
解决办法
2144
查看次数

标签 统计

html ×1

semantic-markup ×1

semantic-web ×1