HelloWorld
HelloWorld

Reputation: 4882

What html5 tag should I use inside a figure tag

The figure tag displays a vertical 2d bar displaying certain values for sales. the figcaption tag displays the label "Sales".

What html5 tag for the divs inside the figure should I use?

<figure>
        <div class="push-center roundedArea" style="background-color:#fff;height:22%;"></div>
        <div class="push-center diagram" style="background-color:#ff99cc;height:11%;">3</div>
        <div class="push-center diagram" style="background-color:#ff33cc;height:44%;">44</div>
        <div class="push-center diagram" style="background-color:#ff66cc;height:23%;">36</div> 
    </figure>
<figcaption>
  Sales
</figcaption>

Upvotes: 12

Views: 13728

Answers (1)

ajp15243
ajp15243

Reputation: 7952

The MDN figure article explains some of the semantic uses of it, which are varied. The figure spec says that it should contain "flow content" with an optional figcaption element before or after the flow content. Flow content is basically anything on this list.

TL;DR: You can put a lot of stuff in there, just make sure it makes semantic sense.

Also, div elements are allowed inside figure elements (see the list in the above link).

Upvotes: 18

Related Questions