「CSS」nth-childで指定行のスタイルシートを適用する
書式
tr:nth-child(行目番号)
使用例
<style>
tr:nth-child(3) {
background-color: skyblue;
font-size: 30px;
}
</style>
<table>
<tr><td>111 aaa</td></tr>
<tr><td>222 bbb</td></tr>
<tr><td>333 ccc</td></tr>
<tr><td>444 ddd</td></tr>
</table>
<style>
tr:nth-child(3) {
background-color: skyblue;
font-size: 30px;
}
</style>
<table>
<tr><td>111 aaa</td></tr>
<tr><td>222 bbb</td></tr>
<tr><td>333 ccc</td></tr>
<tr><td>444 ddd</td></tr>
</table>
<style> tr:nth-child(3) { background-color: skyblue; font-size: 30px; } </style> <table> <tr><td>111 aaa</td></tr> <tr><td>222 bbb</td></tr> <tr><td>333 ccc</td></tr> <tr><td>444 ddd</td></tr> </table>