【问题标题】:Wrapping divs inside figure tag?将 div 包装在图形标签内?
【发布时间】:2013-05-22 17:51:25
【问题描述】:

我想知道在图形标签中为几个拇指中的每一个放置包装 div 是否合适(如下面的示例代码)?

<figure>
  <div class="img-wrapper"><img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423." alt="The castle has one tower, and a tall wall around it."></div>
  <div class="img-wrapper"><img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858." alt="The castle now has two towers and two walls."></div>
  <div class="img-wrapper"><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."></div>
</figure>

或者有没有更合适/更简单的方法来结合 html5 语义和拇指 img 元素的良好样式?

【问题讨论】:

  • 你所拥有的绝对没问题。

标签: html image figure


【解决方案1】:

建议使用嵌套图/figcaptions

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

http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-figure-element

【讨论】:

  • 换句话说:在这种情况下,您可以将图形标签视为 div,对吧?
猜你喜欢
  • 2018-04-19
  • 1970-01-01
  • 1970-01-01
  • 2011-04-17
  • 1970-01-01
  • 2013-06-20
  • 1970-01-01
  • 2019-03-14
  • 2016-09-05
相关资源
最近更新 更多