In this article we are going to discuss, how to add a caption for an image in HTML. Before discussing more we should learn, what is image in html, how to add image and what is caption here we go.
What is image and caption?
The image and caption both are HTML tags which we created in between <figure> attribute.
<Image> tag shows us an image whose link in html code The <caption> tag defines a table caption Tip: so by default, they will center a table caption above a table. Although, the CSS property of text-align and caption-side can be used to align and point the caption. We may write caption as, this is a cute cat, this is a dangerous dragon,etc.
As I told you previously how to add image and now I am discussing how to add caption in HTML file so here, we go first off we are pretty well known <figure> element holds both an <image> and a <figcaption> tags The indirect meaning here is that the contents of <figcaption> caption the rest of the contents of <figure> which in this case is an <img>, but it could have been a video file anything that makes up something that could captioned ‘really’
The other things we may notice is that there is a link inside <figcaption>, this is because <figcaption> is a chunk level element and can have elements inside by its own. And links in a common thing you might find would be <cite>.
<img src="http://placekitten.com/200/300" alt="Small picture of a kitten" />
Small picture of a kitten, graciously shared by <a href="http://placekitten.com">placekitten.com</a>
hope this will help