Figcaption Tag In Html

This post will discuss Tag Figcaption Html with relevant examples and references. This post contains much information that you can use as a learning tool.

The HTML <figcaption> tag is used to provide a caption or title for a <figure> element, which is used to represent content, such as images, illustrations, diagrams, code snippets, etc. The <figcaption> tag should be placed immediately after the opening <figure> tag and before the content it represents.

In a document, utilize the <figure> element for marking up a picture and the <figcaption> element to designate a caption:

Example: 

<!DOCTYPE html> <html> <body> <figure> <img src="https://mrexamples.com/wp-content/uploads/2023/03/samuel-ferrara-1527pjeb6jg-unsplash.jpg" alt="theoxbow" style="width:100%"> <figcaption>Fig.1 The Oxbow, Thomas Cole.</figcaption> </figure> </body> </html>

To style <figure> and <figcaption> apply CSS:

Example: 

<!DOCTYPE html> <html> <head> <style> figure { border: 2px #000 dotted; padding: 5px; margin: auto; } figcaption { background-color: aqua; color: grey; font-style:bold; padding: 2px; text-align: center; } </style> </head> <body> <figure> <img src="https://mrexamples.com/wp-content/uploads/2023/03/samuel-ferrara-1527pjeb6jg-unsplash.jpg" alt="theoxbow" style="width:100%"> <figcaption>Fig.1 The Oxbow, Thomas Cole.</figcaption> </figure> </body> </html>

Another example is using in a code block, where you can explain the purpose of the code snippet:

Example: 

<!DOCTYPE html> <html> <body> <figure> <figcaption>A simple function to calculate the area of a circle</figcaption> <pre><code> function calculateArea(radius) { return Math.PI * Math.pow(radius, 2); } </code></pre> </figure> </body> </html>


Figcaption Html Usage

Figcaption Html tag <figcaption> provides a caption for an <figure> element.

The <figcaption> tag can be specified as either the first or the last child of the <figure> element.


Browser Compatibility

According to the table, the numbers indicate the first browser version to accommodate the element completely.

Element
<figcaption>8.09.04.05.111.0

Attributes

Global

When we talk about Figcaption Html then, the Global Attributes in HTML are indeed accepted by the Tag figcaption <figcaption>.

Event

The Event Attributes in HTML are also accepted by the Tag figcaption <figcaption>.


Predefined CSS

Browsers usually render the <figcaption> element with the corresponding default values:

figcaption {
display: block;
}

Figcaption Tag In Html Advantages

The <figcaption> tag in HTML is used to provide a caption or description for an HTML <figure> element, which can be an image, video, audio, or other media content. Here are some advantages of using the <figcaption> tag:

  • The <figcaption> tag provides a text description for the content within the <figure> element. This helps visually impaired users who rely on screen readers to understand the context of the content.
  • Using <figcaption> tags can improve your website’s SEO. Search engines like Google use captions to understand what the content is about, so using captions and <figcaption> tags can help search engines better index and categorize your content.
  • The <figcaption> tag helps to create a clear visual hierarchy for your content by providing a clear separation between the media content and its description. This makes it easier for users to understand the relationship between the content and its description.
  • The <figcaption> tag can be styled with CSS, allowing you to customize the appearance of the caption to match your website’s design.
If this article was informative enough to fulfill your education desires, then do share this article with your friends by making a click on the links below.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *