css 常见编程题
作者:
WPeach | 来源:发表于
2017-03-12 16:41 被阅读0次
- 请写一个表格以及对应的CSS,使表格奇数行为白色背景,偶数行为灰色背景,鼠标移上去时为黄色背景。
<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>
本文标题:css 常见编程题
本文链接:https://www.haomeiwen.com/subject/hoztnttx.html
网友评论