我创建了一个类似于
的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>
&#13;
我希望所有图像都出现在网格中,并且还要将文本放在相应图像下方。如果文本的长度超过图像,则文本应在第2行继续。您可以在下图中查看我想要的内容。然而,在图像中,文本后面有一个单独的背景,这对我来说并不重要。
答案 0 :(得分:1)
做一些类似 Vucko 的建议,因为图像和p都包含在一个
中a {
display:inline-block; /* Aligns them side by side */
width: 100px; /* You need a fixed width */
margin: 0 10px 10px 0; /* Just for spaces */
}
注意我们针对a,因为在这种情况下,它分别是图像的父级和p。
答案 1 :(得分:0)
尝试这个简单的表格对齐..
<table width="100%">
<tr><td>
<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></td>
<td>
<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></td>
<td>
<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></td>
</tr>
<tr>
<td>
<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></td>
<td>
<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></td>
<td>
<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></td>
</tr>
<tr>
<td>
<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></td>
<td>
<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></td>
<td>
<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></td>
</tr>
<tr>
<td>
<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></td>
<td>
<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></td>
<td>
<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></td>
</tr>
<tr>
<td>
<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></td>
<td>
<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></td>
</tr>
</table>
答案 2 :(得分:0)
<figure>
<img scr='#'>
<figcaption>I am under the image</figcaption>
</figure>