當鼠標經過表格數據行時顏色不同且奇偶行顏色也不同 (純CSS) | 您所在的位置:网站首页 › css奇偶 › 當鼠標經過表格數據行時顏色不同且奇偶行顏色也不同 (純CSS) |
creat bsp auth lin itl 出錯 -type 姓名 class
table test
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 2014-7-9, 14:24:31
Author : Administrator
*/
body{ margin:0 auto; text-align:center}
/*設置表頭的margin為0則表居中顯示,border為0則無邊界*/
table{margin:0 auto;
border:0px;
solid:#000
}
/*設置th表頭的屬性,font-weight為bold則顯示為黑粗*/
table tr th{ height:28px;
width: auto;
line-height:28px;
background:#999;
font-weight:bold
}
table tbody tr{
height:28px;
line-height:28px;
text-align:center;
background:#FFF;
vertical-align:middle;
}
/*
*設置鼠標經過顏色的變化
*/
/*采用csss的這個方法,獲得奇數行,讓後設置其屬性,這樣避免使用expression這個容易出錯的方法*/
table tbody tr:nth-child(odd){
background-color: #DEDEDE
}
table tbody tr:hover{
background-color: #CCCCCC;
}
姓名
性別
班級
姓名
男
計算機科學與技術一班
段萌
男
軟工一班
段萌
男
軟工一班
段萌
男
軟工一班
段萌
男
軟工一班
當鼠標經過表格數據行時顏色不同且奇偶行顏色也不同 (純CSS) |
CopyRight 2018-2019 实验室设备网 版权所有 |