These elements <figure>, <img src=" " alt=" "> and <figcaption> help in adding an image to a webpage. The advantage of <figure> and <figcaption> is that you can provide a caption to your image — otherwise you can standalone use <img src=" " alt= " ">.
Example:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Using Figcaption</title>
</head>
<body>
<section>
<figure>
<img src="https://upload.wikimedia.org/wikipedia/commons/0/01/Rattus_norvegicus_1.jpg" alt="rat">
<figcaption>A wild rat</figcaption>
</figure>
</section>
</body>
</html>
Comments
Post a Comment