Is it semantic for a <figure> element to contain nothing but a <figcaption>? It does validate…
<figure>
<img src="example.jpg">
<figcaption>Image and caption</figcaption>
</figure>
<figure>
<figcaption>Caption only</figcaption>
</figure>
In this context, it’d have ramifications for CSS styling:
figure figcaption { color: red; }
An
imgis not required in afigureelement, it just happens to be common, and most examples that usefigcaptionalso have an image.Note the “if any” part, which leads me to believe that content other than the
figcaptionmay not exist and it will still be valid. However, as Alochi notes, it suggests a misuse of the element since there is no content for the caption to describe.There is an example in the current specification example of non-image content being accompanied by a figcaption, so I think it’s fair to assume it’s perfectly OK to not have an image: