例:Firefoxで<col>とCSSを使用して列にパディングを適用するにはどうすればよいですか?
<style type="text/css">
table {
border: 1px solid red;
border-collapse: collapse;
text-align: left;
}
#col-1 {
padding-left: 20px;
background-color: tan;
}
#specific-cell {
padding-left: 20px;
}
</style>
<table>
<col id="col-1">
<col id="col-2">
<tr>
<th>foo</th>
<th>bar</th>
</tr>
<tr>
<td>data1</th>
<td>data2</th>
</tr>
<tr>
<td id="specific-cell">data1</th>
<td>data2</th>
</tr>
<tr>
<td>data1</th>
<td>data2</th>
</tr>
</table>
色をカラムなくパディングに適用されます。私がクラス/ IDを直接セルに使用すると、それは機能します。
私はそれらを強制的に使用していますか、または<col>
タグを利用する方法はありますか?
非常に洞察力のある答え、ありがとう! – mark