<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
table{
/* border: 1px solid gainsboro; */
border-collapse: collapse;
width: 800px;
text-align: center;
}
tbody tr{
border-bottom: 2px solid black;
}
tbody tr:nth-child(odd){
background: powderblue;
}
tbody tr:nth-child(even){
background: lemonchiffon;
}
th{
background: orange;
color: white;
height: 30px;
border: none;
}
td{
height: 30px;
}
td:hover{
background: orange;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>姓名</th>
<th>菜单1</th>
<th>菜单1</th>
<th>菜单1</th>
</tr>
</thead>
<tbody>
<tr>
<td>小明</td>
<td>内容2</td>
<td>内容3</td>
<td>内容4</td>
</tr>
<tr>
<td>大明</td>
<td>内容2</td>
<td>内容3</td>
<td>内容5</td>
</tr>
<tr>
<td>二名</td>
<td>内容2</td>
<td>内容3</td>
<td>内容5</td>
</tr>
</tbody>
</table>
</body>
</html>
隔行变色:
tbody tr:nth-child(odd) 奇数
tbody tr:nth-child(even) 偶数
给td 加 hover 可以悬浮变色
border-collapse:collapse 合并单元格的外边距