- HTML Tutorial
- HTML - Home
- HTML - History and Evolution
- HTML - Overview
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Headings
- HTML - Paragraphs
- HTML - Quotations
- HTML - Comments
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Style Sheet
- HTML - CSS Classes
- HTML - CSS IDs
- HTML - Images
- HTML - Image Map
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Iframes
- HTML - Blocks
- HTML Backgrounds
- HTML - Backgrounds
- HTML Colors
- HTML - Colors
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Code Builder
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - <figure> Tag
Self-contained content can be identified using the <figure> tag. The tag may include diagrams, images, code examples, and so on. The content of the <figure> tag is connected to the content of the main flow. It is viewed as a standalone unit, though.
The <figcaption> tag is used to give a caption or explanation to the content of the <figure> tag. The <figcaption> tag is positioned as the first or last child element of the <figure> tag. The content will appear at the top of the image if <figcaption> is the first nested element.
Syntax
Following is the syntax of the <figure> tag −
<figure> Image content... </figure>
Example
In the following we are going to use the HTML <figure> tag .
<!DOCTYPE html> <html> <body> <p>Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. The journey commenced with a single tutorial on HTML in 2006 and elated by the response it generated, we worked our way to adding fresh tutorials to our repository which now proudly flaunts a wealth of tutorials and allied articles on topics ranging from programming languages to web designing to academics and much more.</p> <figure> <img src="https://www.tutorialspoint.com/cg/images/logo.png" alt="LOGO" /> </figure> </body> </html>
On running the above code, the output window will pop up, displaying the image along with text on top of the image displayed on the webpage.
Example
Considering the following example, we are going to add the additional alert to our webpage while using the <figure> tag.
<!DOCTYPE html> <html> <body style="background-color:#D5F5E3"> <figure> <img src="https://www.tutorialspoint.com/cg/images/logo.png" alt="computer image" style="width:50%"> <figcaption> <marquee>The Best E-Way Learning</marquee> </figcaption> <br> <button type="buttton" onclick="alert('WELCOME.!')">Click The Button </button> </figure> </body> </html>
When we execute the above code, it will generate the output consisting of the image along with a text button uploaded on the webpage. When the user clicks the button, the event gets triggered and displays the alert message on the screen.
Example
Let’s look at the following example, where we are going to observe the difference between the <div> tag and the <figure> tag.
<!DOCTYPE html> <html> <body style="background-color:#D5F5E3"> <p>Using div:</p> <div> <img src="https://www.tutorialspoint.com/cg/images/logo.png" alt="logo"> <p> TutorialsPoint Logo. </p> </div> <br> <br> <br> <p>using figure:</p> <figure> <img src="https://www.tutorialspoint.com/cg/images/logo.png" alt="Logo"> <figcaption>TutorialsPoint Logo</figcaption> </figure> </body> </html>
On running the above code, it will generate an output consisting of both the image and the text used with the <div> and <figure> tags that were uploaded on the webpage.