我有 3 个推荐,将在我正在开发的网站中使用。我已经阅读了 block 引用,并且我相信这是最适合它们的标签。
这是我在论坛上找到的基本引用:
<blockquote>
<p>Pellensque.</p>
<p>Pellentesque.</p>
<p class="credit"><cite>Name</cite>, Title</p>
</blockquote>
使用 cite 标签来陈述人名和头衔在语义上是否正确?
我读到它的预期用途是指向引用的原始 URL 来源。
此外,在检查某些网站的 html 时,我发现其中一个使用 h3 作为引文,使用 h6 作为名称和标题。这符合最佳实践吗?
或者纯粹用 CSS 调整文本的线宽和其他属性是否更好?
最佳答案
I read that its intended use is to point to the original URL source of the quote.
那就是 cite
<blockquote>
的属性元素。请参阅here在 HTML5 规范中。您正在查看的是 <cite>
element ,为此标记引文的标题或作者(如所示)是适当的。
Also, when inspecting some site's html, I found one that used an h3 for the quotation and h6 for the name and title. Is this in line with best practice?
如果标题是引文的一部分,那么使用相应的 h 元素标记这些标题就可以了,因为您按原样复制标题。但是,引文不是标题,因此使用标题来标记引文是不合适的。
除此之外,<blockquote>
元素非常适合标记推荐。
关于css - 语义正确的 block 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33876649/