到目前为止,一切看起来都很棒,但是我的边框间距有问题,没有任何原因,如下所示:
到目前为止,我的css中有边框间距,但它没有做任何事情,我不确定为什么会这样。
HTML:
<section class="s">
<center>
<table class="t">
<caption class="ex2">HTML Table with CSS</caption>
<tr>
<td class="r1c1">This</td>
<td class="r1c2">Little</td>
<td class="r1c3">Piggy</td>
<td class="r1c4">Went</td>
<td class="r1c5">To</td>
<td class="r1c6">Market</td>
</tr>
<tr>
<td class="r2c1" colspan="2">This</td>
<td class="r2c2">Little</td>
<td class="r2c3">Piggy</td>
<td class="r2c4">Went</td>
<td class="r2c5">To</td>
</tr>
<tr>
<td class="r3c1" colspan="2" rowspan="2">This</td>
<td class="r3c2" rowspan="2">Little</td>
<td class="r3c3">Piggy</td>
<td class="r3c5" rowspan="2">To</td>
<td class="r3c6" rowspan="2">Market</td>
</tr>
<tr>
<td class="r3c4">Went</td>
</tr>
<tr>
<td class="r4c1">Little</td>
<td class="r4c2">Piggy</td>
<td class="r4c4">Went</td>
<td class="r4c5">To</td>
<td class="r4c5" colspan="2">Market</td>
</tr>
</table>
</center>
</section>
CSS:
table.t
{
border: 1px solid;
border-spacing: 30px;
text-align: center;
}
td.r1c1 { border: 1px solid; background-color: #6DFFA8; }
td.r1c2 { border: 1px solid; background-color: #6DFFCC; }
td.r1c3 { border: 1px solid; background-color: #6DFFFF; }
td.r1c4 { border: 1px solid; background-color: #70E8FF; }
td.r1c5 { border: 1px solid; background-color: #74CEFF; }
td.r1c6 { border: 1px solid; background-color: #78BAFF; }
td.r2c1 { border: 1px solid; background-color: #6DFFA8; }
td.r2c2 { border: 1px solid; background-color: #33FAB4; }
td.r2c3 { border: 1px solid; background-color: #33F9D8; }
td.r2c4 { border: 1px solid; background-color: #34F0F9; }
td.r2c5 { border: 1px solid; background-color: #3CBCF9; }
td.r3c1 { border: 1px solid; background-color: #6DFFA8; }
td.r3c2 { border: 1px solid; background-color: #00F9F9; }
td.r3c3 { border: 1px solid; background-color: #1094FA; }
td.r3c4 { border: 1px solid; background-color: #1A5EFA; }
td.r3c5 { border: 1px solid; background-color: #242AFA; }
td.r3c6 { border: 1px solid; background-color: #511CFA; }
td.r4c1 { border: 1px solid; background-color: #6DFFA8; }
td.r4c2 { border: 1px solid; background-color: #00D67B; }
td.r4c3 { border: 1px solid; background-color: #00CBCB; }
td.r4c4 { border: 1px solid; background-color: #0E7CD1; }
td.r4c5 { border: 1px solid; background-color: #1750D4; }
答案 0 :(得分:1)
border-collapse:separate;
表格规则缺少border-spacing
才能正常使用
table.t
{
border-collapse:separate;
}