28

I am trying to build a clean HTML5 structure for my projects,
I didnt get the usage variety for Figure tag;
Can we really use Video in Figure as this page said:
http://oopeducation.com/html5/html5-figure-tag/

Or is it only for images?

Thank you!

Digerkam
  • 1,826
  • 4
  • 24
  • 39

2 Answers2

38

Yes you can - according to the HTML5 spec, a <figure> permits flow content (which is comprised of both flow elements & normal character data). Given that <video> & <audio> are both one of the many flow elements, it is perfectly valid for them to be nested within a figure.

This article from HTML5 Doctor seems to suggest the same thing, take a look.

Adrift
  • 58,167
  • 12
  • 92
  • 90
13

Yes, it is possible.

This is the definition of the <figure> tag as specified by W3C:

The figure element represents some flow content, optionally with a caption, that is self-contained and is typically referenced as a single unit from the main flow of the document.

The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc, that are referred to from the main content of the document, but that could, without affecting the flow of the document, be moved away from that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix.

Here you can see an example extracted by W3C documentation, in which a <video> tag is included in a <figure> tag.

<figure>
 <video src="ex-b.mov"></video>
 <figcaption>Exhibit B. The <cite>Rough Copy</cite> trailer.</figcaption>
</figure>

You can find the official W3C documentation here: http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-figure-element

Fabio
  • 2,074
  • 2
  • 24
  • 38
  • while I was searching, there was no clean information about it, like a hidden reality :) Thank you! – Digerkam Jan 16 '13 at 02:07
  • 2
    you are welcome. Also html5doctor.com is a trusted website so it's fine, anyway remember that the ONLY TRUE official documentation is that of W3C.org, they are the people who make the standard specifications. So if you can find info from multiple places, if you find info on w3c.org, choose that info. @Digerkam – Fabio Jan 16 '13 at 02:20
  • You are right, I will keep it in mind! Most of time by searchs, W3C looks like a standart spec provider for browser programmer (with that site design and tons of informations) I know it is not, but that style :) – Digerkam Jan 16 '13 at 05:29
  • @Fabio Do you know if it is correct to use the fig caption tag to put the html5 video controls inside there, meaning putting button and slider tags? – BDB88 Dec 01 '21 at 02:24