【问题标题】:html figure element: can figcaption be placed before imghtml图形元素:figcaption可以放在img之前吗
【发布时间】:2017-11-18 01:34:47
【问题描述】:

figcaption 元素置于figure 元素内的任何位置在语义/语法上是否正确?

考虑以下几点:

<figure>
  <figcaption>Hello caption</figcaption>
  <img src="/path/to/file">
</figure>

【问题讨论】:

    标签: html semantic-markup


    【解决方案1】:

    tl;博士:

    • W3C:figcaption 可以放置在 figure 中的任何位置(作为孩子,而不是后代)
    • WHATWG:figcaption 可以作为figure 的第一个或最后一个孩子放置

    W3C

    In HTML5figcaption 元素必须是figure 的第一个或最后一个子元素:

    任一:一个figcaption 元素,后跟流内容。
    或者:流内容后跟一个figcaption 元素。
    或者:流内容。

    In HTML 5.1figcaption元素可以放在figure元素的任意位置:

    流内容可选地包括figcaption 子元素。

    In HTML 5.1 2nd Edition 也是。

    In HTML 5.2 (Proposed REC) 也是。

    关于更改的问题如下:
    Allow figcaption anywhere in a figure element?

    什么工作组

    In the HTML Living Standard(截至 2017-11-17),与 HTML5 相同:

    任一:一个figcaption 元素,后跟流内容。
    或者:流内容后跟一个figcaption 元素。
    或者:流内容。

    【讨论】:

      猜你喜欢
      • 2012-11-23
      • 1970-01-01
      • 2011-12-08
      • 1970-01-01
      • 1970-01-01
      • 2021-06-18
      • 1970-01-01
      • 2010-09-19
      • 1970-01-01
      相关资源
      最近更新 更多