tableZebra.html
<!DOCTYPE html>
<html>
<head>
<title>jQuery表格斑马线</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
table{
border-collapse:collapse; /* 合并边框属性 */
width: 100%;
}
tr{
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: lightgray;
height:35px;
}
.color{
background-color:#f8f8f8;
}
td{
width:25%;
text-align:center;
}
</style>
<script src="jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("tr:even").addClass("color");
});
</script>
</head>
<body>
<table>
<tr>
<th>id</th>
<th>名称</th>
<th>血量</th>
<th>伤害</th>
</tr>
<tr>
<td>1</td>
<td>gareen</td>
<td>340</td>
<td>58</td>
</tr>
<tr >
<td>2</td>
<td>teemo</td>
<td>320</td>
<td>76</td>
</tr>
<tr >
<td>3</td>
<td>annie</td>
<td>380</td>
<td>38</td>
</tr>
<tr >
<td>4</td>
<td>deadbrother</td>
<td>400</td>
<td>90</td>
</tr>
</table>
</body>
</html>