Is it semantically/syntactically correct to have the figcaption
element be positioned anywhere within the figure
element?
Consider the following:
<figure>
<figcaption>Hello caption</figcaption>
<img src="/path/to/file">
</figure>
tl;dr:
figcaption
can be placed anywhere in figure
(as child, not descendant)figcaption
can be placed as first or as last child of figure
In HTML5, the figcaption
element has to be the first or the last child of figure
:
Either: One
figcaption
element followed by flow content.
Or: Flow content followed by onefigcaption
element.
Or: Flow content.
In HTML 5.1, the figcaption
element can be placed anywhere in the figure
element:
Flow content optionally including a
figcaption
child element.
In HTML 5.1 2nd Edition, too.
In HTML 5.2 (Proposed REC), too.
Here’s the issue about the change:
Allow figcaption anywhere in a figure element?
In the HTML Living Standard (as of 2017-11-17), it’s the same as in HTML5:
Either: One
figcaption
element followed by flow content.
Or: Flow content followed by onefigcaption
element.
Or: Flow content.