<!DOCTYPE html>
<!–
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.
–>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<link href=”table.css” type=”text/css” rel=”stylesheet” />
<title>table test</title>
<!– <style>
table tbody tr:hover{
background-color: #EEECEB;
}
</style> –>
</head>
<body>
<table>
<tr>
<th>姓名</th>
<th>性別</th>
<th>班級</th>
</tr>
<tbody>
<tr>
<td>姓名</td>
<td>男</td>
<td>計(jì)算機(jī)科學(xué)與技術(shù)一班</td>
</tr>
<tr>
<td>段萌</td>
<td>男</td>
<td>軟工一班</td>
</tr>
<tr>
<td>段萌</td>
<td>男</td>
<td>軟工一班</td>
</tr>
<tr>
<td>段萌</td>
<td>男</td>
<td>軟工一班</td>
</tr>
<tr>
<td>段萌</td>
<td>男</td>
<td>軟工一班</td>
</tr>
</tbody>
</table>
</body>
/*
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}
/*設(shè)置表頭的margin為0則表居中顯示,border為0則無邊界*/
table{margin:0 auto;
border:0px;
solid:#000
}
/*設(shè)置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;
}
/*
*設(shè)置鼠標(biāo)經(jīng)過顏色的變化
*/
/*采用csss的這個(gè)方法,獲得奇數(shù)行,讓后設(shè)置其屬性,這樣避免使用expression這個(gè)容易出錯(cuò)的方法*/
table tbody tr:nth-child(odd){
background-color: #DEDEDE
}
table tbody tr:hover{
background-color: #CCCCCC;
}
新聞熱點(diǎn)
疑難解答
圖片精選