<figcaption> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:figcaption

Introduction

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

The figcaption Element summary

Item Value
Element figcaption
Element TypeN/A
Permitted Parentsfigure
Local AttributesNone
ContentsFlow content
Tag Style Start and end tag
New in HTML5Yes
Changes in HTML5 N/A

Style Convention

figcaption {
   display: block;
}

Using the figure and figcaption Elements

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <figure> 
         <figcaption>
            Listing of code
         </figcaption> 
         <pre>
            <!--from   w w  w. j  a  v  a2s.  c  o  m-->
            <code>
               
                var items = ["A", "B", "C", "D"];
               <br>
               
                document.writeln("I like " + items.length + " items");
            
            </code>
            
         </pre> 
      </figure>  
   </body>
</html>

Related Tutorials