当鼠标经过时颜色不同,且奇偶行颜色不同,有需要的朋友可以参考下,
当鼠标经过时颜色不同,且奇偶行颜色不同
。
姓名
男
计算机科学与技术一班
段萌
男
软工一班
段萌
男
软工一班
段萌
男
软工一班
段萌
男
软工一班
/*
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;
}