Use figure and figcaption to create figures

Description

HTML5 figures are content, optionally with a caption, self-contained, typically referenced as a single unit.

You define figures using the figure element.

The figure element can optionally contain a figcaption element, which denotes a caption for the figure.

Example

You can see the figure and figcaption elements used together in the following code.


<!DOCTYPE HTML>
<html>
<body>
  I like XML and CSS.<!--from  w  ww  . j  a va 2  s .c  o  m-->
  <figure>
    <figcaption>Listing 01. Using the code element</figcaption>
    <code>
      var fruits = ["CSS", "HTML", "CSS", "Javascript"];<br>
      document.writeln("I like " + fruits.length + " fruits");
    </code>
  </figure>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed