How to create a caption for a figure element using HTML5 ?

In this article, you learn how to create a caption for a figure element by using the <figcaption> tag in the document. This new tag in the HTML5 page is used to set a caption to the figure element in a document.

Syntax:

<figcaption> Figure caption </figcaption>

Example: The following example demonstrates to apply caption for a HTML figure element.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to define a caption 
        for a figure element?
    </title>
  
    <style>
        body {
            text-align: center;
        }
  
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <h2>
        HTML5: How to define a 
        caption for a figure 
        element?
    </h2>
  
    <figure>
        <img src=
        alt="gfglogo" style="width:50%">
  
        <figcaption>
            GeeksforGeeks Logo
        </figcaption>
    </figure>
</body>
  
</html>                        

chevron_right


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.