【发布时间】:2012-12-07 13:41:16
【问题描述】:
我正在尝试将图像与标题并排放置。
默认情况下开箱即用,执行以下操作:
<figure>
<img src="1.jpg" width=320 height=240 alt="Image 1">
<img src="2.jpg" width=320 height=240 alt="Image 2">
<img src="3.jpg" width=320 height=240 alt="Image 3">
<img src="4.jpg" width=320 height=240 alt="Image 4">
</figure>
如果我的宽度允许,我会并排获得图像列表。我得到我想要的。是这样的2列图像:
Image 1 Image 2
Image 3 Image 4
现在如果我添加 figcaption 如下:
<figure>
<img src="1.jpg" width=320 height=240 alt="Image 1">
<figcaption>caption 1</figcaption>
<img src="2.jpg" width=320 height=240 alt="Image 2">
<figcaption>caption 2</figcaption>
<img src="3.jpg" width=320 height=240 alt="Image 3">
<figcaption>caption 3</figcaption>
<img src="4.jpg" width=320 height=240 alt="Image 4">
<figcaption>capton 4</figcaption>
</figure>
一切看起来像这样:
Image 1
caption 1
Image 2
caption 2
Image 3
caption 3
Image 4
caption 4
我也在玩列表、层次结构和 css。
问题是我怎样才能做到以下几点?
Image 1 Image 2
caption 1 caption 2
image 3 Image 4
caption 3 caption 4
非常感谢, 卡罗利斯
【问题讨论】:
-
HTML5 Doctor 说一个图中只允许有 1 个 figcaption:html5doctor.com/the-figure-figcaption-elements
-
好的,谢谢,但我的目标是最后一点,如何用
和 和 css 制作 2 列? -
使用“div”:jsfiddle.net/ZksyN
-
非常感谢!但在我的情况下,我必须使用宽度:1oo%而不是宽度:320px,否则一切都会搞砸,但在这种情况下,排序再次只是一个接一个,而不是并排:/ - 我可以使用一些东西吗?显示:块左右?
-
您没有在任何地方指定
width: 100%。这些是您提问时需要提供的重要细节。