gpt4 book ai didi

html - "Correct"在 HTML 中标记推荐的方法

转载 作者:技术小花猫 更新时间:2023-10-29 12:06:05 25 4
gpt4 key购买 nike

我原以为这很容易在网上找到,但事实并非如此。我正在尝试找出在页面上标记推荐列表(引用作者)的正确方法。

例如

"This is what I think"
- My Name, My Company

我想引用应该放在 block 引用中。我还看到一些使用 cite 来显示引用的来源,但 HTML 引用似乎表明这应该用于给出引用来自的网页的 URL,而不是人名。

有人对如何标记它有什么建议吗?

最佳答案

“旧”方式:

我可能很晚才插话,但我认为以下是标记推荐的正确方法:

<figure>
<blockquote>
"This is what I think"
</blockquote>
<footer>
— <cite class="author">My Name</cite>, <cite class="company">My Company</cite>
</footer>
</figure>

根据 W3C 规范:

...the citation is contained within the footer of a figure element, this groups and associates the information, about the quote, with the quote...

.

.

.

The figure element represents some flow content, optionally with a caption, that is self-contained (like a complete sentence)...

更新:

正如@MCTaylor17 指出的那样,引用引语的最佳做法已经改变。这是新规范(截至 2017 年 12 月):https://www.w3.org/TR/html52/textlevel-semantics.html#the-cite-element

现在 <cite>元素出现在任何你期望的地方Phrasing Content .这意味着它应该在 <p> 内。 , <blockquote>

规范中的示例 17 演示了使用 <cite><blockquote> 内:

  <blockquote>"Money is the real cause of poverty,"
<footer>
<cite id="baseref">The Ragged-Trousered Philanthropists, page 89.</cite>
</footer>
</blockquote>

将其应用到您自己的报价中:

<blockquote>
"This is what I think"
<footer>
— <cite class="author">My Name</cite>, <cite class="company">My Company</cite>
</footer>
</blockquote>

关于html - "Correct"在 HTML 中标记推荐的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1130565/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com