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!
You cannot use a figure tag to embed an image in the HTML5 document, try adding the src attribute to the figure tag in the same manner as of img tag, and you will notice that the image is not displayed. So, for adding the image, nothing has changed in the HTML5 documentation we still use the img tag for the same.
Definition and Usage. The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc. While the content of the <figure> element is related to the main flow, its position is independent of the main flow, and if removed it should not affect the flow of the document.
The <video> tag is used to embed video content in a document, such as a movie clip or other video streams. The <video> tag contains one or more <source> tags with different video sources. The browser will choose the first source it supports.
1. The figure tag is used to semantically organize the content of images, videos, audios or even charts or tables, block of codes in the HTML document. The image tag is used to add an image to an HTML page.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With