图中的块引用:何时使用页脚,何时使用figcaption?

时间:2018-02-06 08:54:28

标签: html html5 semantic-markup

w3.org's blockquote-page上有两个例子:

Example 14

<figure>
    <blockquote>
        "That monster custom, who all sense doth eat
        Of habit’s devil," <abbr title="et cetera">&c.</abbr> not in Folio

        "What a falling off was there !
        From me, whose love was of that dignity
        That it went hand in hand even with the vow
        I made to her in marriage, and to decline
        Upon a wretch."
    </blockquote>

    <footer>
        — <cite class="title">Shakespeare manual</cite>
        by <cite class="author">Frederick Gard Fleay</cite>,
        p19 (in Google Books)
    </footer>
</figure>

Example 19

<figure>
    <blockquote>
        <p>
            The truth may be puzzling. It may take some work to grapple with.
            It may be counterintuitive. It may contradict deeply held
            prejudices. It may not be consonant with what we desperately want to
            be true. But our preferences do not determine what’s true. We have a
            method, and that method helps us to reach not absolute truth, only
            asymptotic approaches to the truth — never there, just closer
            and closer, always finding vast new oceans of undiscovered
            possibilities. Cleverly designed experiments are the key.
        </p>
    </blockquote>

    <figcaption>
        <cite>Carl Sagan</cite>,
        in "<cite>Wonder and Skepticism</cite>",
        from the <cite>Skeptical Inquirer</cite> Volume 19, Issue 1 (January-February 1995)
    </figcaption>
</figure>

两者看起来与我非常相似 - 内容方面。但他们说关于第一个

  

注意
  在上面的示例中,引文包含在a的footer中   figure元素,它将信息分组并关联   引用,引用。在这种情况下,未使用figcaption元素,   作为引用的容器,因为它不是标题。

但是,我不明白两个版本之间的区别。有人可以解释区别以及区分footerfigcaption

的重要性

1 个答案:

答案 0 :(得分:3)

基于以下事实:

  1. 正如您所见,W3C规范中的非规范性示例似乎相互矛盾。
  2. W3C规范不包含任何规范性文本,表明任一选项都不合适。其中一个示例声称引文不是标题,但由于它不是规范性的,因此您完全有权不同意。
  3. 来自this WHATWG issue,生活规范编辑器以及W3C CSSWG(即非HTML WG)成员认为差异在实践中并不重要,尽管前者似乎倾向于figcaption
  4. 在实践中,大多数作者无论如何都将归因信息放在figcaption中,没有明显的影响。
  5. ...结论似乎是两者之间没有任何有意义或实际的区别,无论你选择使用哪一个都是个人偏好的问题。

    话虽如此,如果您仍然无法做出决定,figcaption更符合这两个规范,而不是一致性(因为footerfigcaption 同样符合),但就它们如何描述其角色和用法而言,尤其是与figure元素的关系(通常,您希望与图形相关联的文本作为其标题)。无论哪种方式,大多数重要的是cite元素,因为最终它们是传达归属语义的元素,而不是它们的容器元素。