HTML5标记用于一组缩略图



我很好奇什么标签封装一组缩略图最具语义意义?使用<figure>标签有意义吗(阅读html5规范,还不清楚)?还是坚持使用<div>,或者它被认为是自己的<section>

通常情况下,我可能会使用div来分割它,但为了利用html5的语义结构,我希望可能会有一个更适合这类内容的标签。

想法?建议?欢迎所有人。谢谢

从语义的角度来看,使用<figure>可能是最合适的。如果您检查HTML5规范,您会发现在单个<figure>声明中包含一系列图像是完全可以接受的。

示例:

<figure>
 <img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
      alt="The castle has one tower, and a tall wall around it.">
 <img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
      alt="The castle now has two towers and two walls.">
 <img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
      alt="The castle lies in ruins, the original tower all that remains in one piece.">
 <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption>
</figure>

HTML5Doctor.com上也有一个类似的例子,其中多个图像(可以很容易地成为缩略图)被列为单个<figure>元素的子元素。

最新更新