[CSS]nth-childで偶数の行のスタイルシートを適用する
書式
tr:nth-child(2n)
使用例
<style>
tr:nth-child(2n) {
background-color: skyblue;
font-size: 20px;
}
</style>
<table>
<tr><td>111</td></tr>
<tr><td>222</td></tr>
<tr><td>333</td></tr>
<tr><td>444</td></tr>
</table>
<style>
tr:nth-child(2n) {
background-color: skyblue;
font-size: 20px;
}
</style>
<table>
<tr><td>111</td></tr>
<tr><td>222</td></tr>
<tr><td>333</td></tr>
<tr><td>444</td></tr>
</table>
<style> tr:nth-child(2n) { background-color: skyblue; font-size: 20px; } </style> <table> <tr><td>111</td></tr> <tr><td>222</td></tr> <tr><td>333</td></tr> <tr><td>444</td></tr> </table>