[CSS]テーブル(table、td)の背景色を指定するサンプル
書式
table {background :xxx}
td {background:xxx}
使用例
<style>
table {
border-collapse: separate;
border-spacing: 1px;
width: 100px;
/*背景色としてtableにyellowを指定*/
background: yellow
}
td {
/*背景色としてtdにskyblueを指定*/
background: skyblue
}
</style>
<table>
<tr>
<td>AA</td>
<td>11</td>
</tr>
<tr>
<td>BB</td>
<td>22</td>
</tr>
</table>
<style>
table {
border-collapse: separate;
border-spacing: 1px;
width: 100px;
/*背景色としてtableにyellowを指定*/
background: yellow
}
td {
/*背景色としてtdにskyblueを指定*/
background: skyblue
}
</style>
<table>
<tr>
<td>AA</td>
<td>11</td>
</tr>
<tr>
<td>BB</td>
<td>22</td>
</tr>
</table>
<style> table { border-collapse: separate; border-spacing: 1px; width: 100px; /*背景色としてtableにyellowを指定*/ background: yellow } td { /*背景色としてtdにskyblueを指定*/ background: skyblue } </style> <table> <tr> <td>AA</td> <td>11</td> </tr> <tr> <td>BB</td> <td>22</td> </tr> </table>