您好,我是 html 和 css 的新手,我有一个问题。我正在尝试在彼此相邻的框的中心显示 4 张图像。我目前正在使用表格,但这在我的 html 和 css 中提供了很多代码:
CSS:
/*box*/
#content2{
margin: 30px 0;
background: white;
padding: 20px;
clear: both;
box-shadow: 0px 1px 1px #999;
text-align: center;
overflow:hidden;
}
/*table*/
table{
margin-right: auto;
margin-left: auto;
display: inline-block;
}
td,th{
padding: 20px;
}
然后到很多html:
<div id="content2">
<h4>Onze producten</h4>
<table>
<tr>
<td><a href="../html/kleding.html"> Pika deken</a></td>
</tr>
<tr>
<td><a href="../html/kleding.html"><img src="../images/baby1.jpg"></a></td>
</tr>
<tr>
<td>€20</td>
</tr>
</table>
<table>
<tr>
<td><a href="../html/kleding.html">School outfit</a></td>
</tr>
<tr>
<td><a href="../html/kleding.html"><img src="../images/boy1.jpg"></a></td>
</tr>
<tr>
<td>€140</td>
</tr>
</table>
<table>
<tr>
<td><a href="../html/kleding.html">Bussines girl</a></td>
</tr>
<tr>
<td><a href="../html/kleding.html"><img src="../images/girl2.jpg"></a></td>
</tr>
<tr>
<td>€250</td>
</tr>
</table>
<table>
<tr>
<td><a href="../html/kleding.html">Summer</a></td>
</tr>
<tr>
<td><a href="../html/kleding.html"><img src="../images/girl1.jpg"></a></td>
</tr>
<tr>
<td>€99.99</td>
</tr>
</table>
</div>
有没有办法更有效地做到这一点?设计必须保持流动性。提前致谢