Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The article tag and the img

I understand that the article tag is "an independent item section of content" www.w3.org/wiki/HTML/Elements/article

I have a page only with a blog post. That blog has an img and a caption on top of the text (it is an img that illustrates what I tell in the text of the blog). Should the img and caption be inside or outside the article tag?

The img:

<img src="1.png">
<div>Caption of the image</div>

The blog post simplified:

<article>
<h1>Title of the post</h1>
<div>Last Updated: 2016-01-07</div>
<div>       
    <p>This is the body of the post</p>
</div>
<p>Author of the post</p>
</article>
like image 365
Nrc Avatar asked Oct 20 '25 14:10

Nrc


1 Answers

You may want to check both figure and figcaption tags.

example from the docs:

<figure>
  <img src="https://developer.cdn.mozilla.net/media/img/mdn-logo-sm.png" alt="An awesome picture">  
  <figcaption>Fig1. MDN Logo</figcaption>
</figure>

And if the figure is related to the article, then I'd put it inside the article tag.

like image 133
rafaelbiten Avatar answered Oct 22 '25 04:10

rafaelbiten



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!