Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to add caption to an image using html5

Tags:

I am trying to work out the correct way to display a caption with an image, something like here makes sense jfiddle link but i am also looking at figure and figcaption which appears to serve the purpose better and I prefer ie:

<figure>
<img src="/animage.jpg" alt="an image">
<figcaption>This is the caption</figcaption>
</figure>

I am building a template for a blog news post so does either way matter or is there a correct use for figcaption that im missing?

like image 341
Bradz Avatar asked May 17 '13 09:05

Bradz


1 Answers

I would use the <figure> method as it has more semantic meaning than the div / span example.

<figure class="image">   <img src="http://[..]" />   <figcaption>I am an image caption</figcaption> </figure> 

http://jsfiddle.net/duncan/KYTWS/

related, although about blockquotes, http://alistapart.com/blog/post/more-thoughts-about-blockquotes-than-are-strictly-required

like image 123
Duncan Beattie Avatar answered Oct 23 '22 02:10

Duncan Beattie