- 請寫一個表格以及對應的CSS悼吱,使表格奇數(shù)行為白色背景垂涯,偶數(shù)行為灰色背景,鼠標移上去時為黃色背景萄凤。
<style type="text/css">
.table tr:nth-child(2n-1){
background-color: #fff;
}
.table tr:nth-child(2n){
background-color: #ccc;
}
.table tr:hover{
background-color: yellow;
}
</style>
<body>
<table class="table">
<tr><td>第一行</td> </tr>
<tr> <td>第二行</td></tr>
<tr><td>第三行</td></tr>
<tr> <td>第四行</td></tr>
<tr><td>第五行</td></tr>
</table>
</body>