FFBbodie
FFBbodie

Reputation: 111

i don't understand the figure tag exactly

I don't understand the figure tag from HTML 5 exactly. i have searched on internet but i sill don't understand some things.

I know that you can use figure tag for images like photos etc. But I am wondering: must I put the images like small icons or logos in the figure tag too and can I nest a figure inside a figure tag? or more images in one figure?

thanks..

Upvotes: 0

Views: 235

Answers (1)

zsaat14
zsaat14

Reputation: 1118

The <figure> tag is just a specially named <div>. It normally contains one <img> tag and one <figcaption> tag. The idea is that it provides a specially named container for an image and its caption so that it is easier to style. I do not think figure tags were meant to be nested. Think about a book. There is normally only one image and caption per figure. Not every image needs to be enclosed in the <figure> tag. In fact, no images have to be. In short, you do not have to use the <figure> tag, but when you do, the syntax looks like this:

<figure>
    <img src='image.png'>
    <figcaption>This is the caption.</figcaption>
</figure>

Upvotes: 1

Related Questions