【发布时间】:2014-12-13 00:11:13
【问题描述】:
我已经创建了一个像下面这样的html
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
<a href="http://google.com">
<img src="C:\Users\HOME\Desktop\maxresdefault.jpg" width="100" height="100">
<p style="clear: both;">text in the pararaph is created using html</p>
</a>
我希望所有图像都显示在网格中,并且在相应图像下方显示文本。如果文本的长度超过图像,则文本应在第二行继续。您可以在下图中检查我到底想要什么。然而,在图像中,文本后面有一个单独的背景,这对我来说并不重要。
【问题讨论】:
-
请添加你的css代码
-
试试
a{display:inline-block; width: 100px; text-align:center}