Categories
Tags
a Accessibility Advanced Algorithms Alias Bash bash Basics Beginners Best Practices Big O bun cat cd CLI Comments Container Elements Container Queries cp css CSS Data Structures deno Doctype Download Editors Error Examples Features figure File Watching Filesystem fish Fish Shell footer frontend Guide header Hello World History Homebrew HTML HTML5 humor img javascript JavaScript Learning less Links linux Linux ls macOS Media Queries meta Mobile-First mv Netcat Networking Node.js npm Package Manager picture pm2 Productivity programming Programming pwd Responsive Design Responsive Images rmdir Scalability section Semantic HTML shell Shell Shell Script Shells srcset State Management Structure Svelte Svelte Store SvelteKit svg Tables tail Text Formatting Tools touch Troubleshooting Tutorial Unix ux Vim web development Web Development web-development webdev
136 words
1 minutes
The `figure` Tag in HTML: Explained
The figure
Tag in HTML: Explained
The <figure>
tag in HTML is used to group media content, such as images, diagrams, or code snippets, along with their captions. This guide explains the usage of the <figure>
tag.
Basic Syntax
The <figure>
tag is used in conjunction with the <figcaption>
tag to provide a caption for the content:
<figure>
<img src="image.jpg" alt="Description of the image">
<figcaption>Caption for the image</figcaption>
</figure>
Use Cases
Images with Captions
The <figure>
tag is commonly used to group images with their captions:
<figure>
<img src="image.jpg" alt="Description of the image">
<figcaption>Image caption goes here.</figcaption>
</figure>
Code Snippets with Captions
You can also use the <figure>
tag to group code snippets with their descriptions:
<figure>
<pre><code>console.log("Hello World");</code></pre>
<figcaption>JavaScript code snippet</figcaption>
</figure>
Conclusion
The <figure>
tag is a useful HTML element for grouping media content with captions. It provides semantic meaning and improves the accessibility of your content.
The `figure` Tag in HTML: Explained
https://zxce3.net/posts/the-figure-tag-in-html-explained/