What is the correct way to mark up the author of a (block)quote?

老子叫甜甜 提交于 2019-12-04 03:48:51

问题


I'm trying to figure out the correct way to add attribution for a quote.

It seems the internet is divided about the correct way.

Html5Doctor says the following:

<blockquote>
    <p>A quote...</p>
    <footer>
        <a href="source of the quote">Author of the quote</a>
    </footer>
</blockquote>

But they also state that eventually the figured out that using the footer element wasn't actually valid. They currently still do not provide the 100% correct way.

Their latest update was on 2012-02-14. No further information has been added.

Another option would be to replace the <footer> with a <cite> element, but w3c states that the <cite> element should only contain a title of a work and definitely not the author (source: w3c)

So the question is: Is there currently a correct way to provide attribution for a quote? And if so: what is it?


回答1:


It seems the internet is divided about the correct way.

Up until 2014, both W3C and WHATWG seemed to agree on the following:

Attribution for the quotation, if any, must be placed outside the blockquote element.

For example, here the attribution is given in a paragraph after the quote:

<blockquote>
 <p>I contend that we are both atheists. I just believe in one fewer
 god than you do. When you understand why you dismiss all the other
 possible gods, you will understand why I dismiss yours.</p>
</blockquote>
<p>— Stephen Roberts</p>

The other examples below show other ways of showing attribution.

And for the cite element:

A person's name is not the title of a work — even if people call that person a piece of work — and the element must therefore not be used to mark up people's names. (In some cases, the b element might be appropriate for names; e.g. in a gossip article where the names of famous people are keywords rendered with a different style to draw attention to them. In other cases, if an element is really needed, the span element can be used.)

The rest of the examples mentioned make use of other elements such as cite and figcaption, but all of them demonstrate these elements being placed somewhere outside the blockquote element in question.

Since 2014, however, W3C HTML5 was changed to match HTML 4 again, allowing the use of cite for marking up the author name in a blockquote. The text in WHATWG HTML remains unchanged, so now not only is the rest of the internet divided about it, but so are the two standards bodies. But perhaps what's most amusing about all this is that the definition in WHATWG HTML (and W3C HTML5 before 2014) actually matches that of HTML 3.2, even though the current W3C HTML5 definition matches that of HTML 4.

Then again, since HTML 4 is the mainstream version of HTML that everyone is familiar with, perhaps it's OK to just stick to its more permissive definition.




回答2:


If you read all of the HTML5Doctor article you linked, you'll see that "The official recommendation is to put the blockquote in a figure and add attribution in <figcaption>".

That is:

<figure>
  <blockquote>
    <p>A quote...</p>
  </blockquote>
  <figcaption>
    <a href="source of the quote">Author of the quote</a>
  </figcaption>
</figure>

I am unsure whether that recommendation still stands; but it does fit the requirement of being outside the blockquote element.



来源:https://stackoverflow.com/questions/19429899/what-is-the-correct-way-to-mark-up-the-author-of-a-blockquote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!