<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
table,tr,th,td{
border: 1px solid #d6d6d6;
}
table{
width: 100%;
/* 合并表格边框 */
border-collapse: collapse;
font-size: 14px;
color: #555;
/* 设置表格布局算法 */
table-layout: fixed;
}
th,td{
padding: 6px 12px;
}
tr:nth-child(odd){
background:aliceblue;
}
tr:hover{
background: lightpink;
}
</style>
</head>
<body>
<table>
<tr>
<th>name</th>
<th>age</th>
<th>hobby</th>
</tr>
<tr>
<td>mt</td>
<td>1</td>
<td>coding</td>
</tr>
<tr>
<td>hl</td>
<td>2</td>
<td>coding</td>
</tr>
<tr>
<td>ph</td>
<td>3</td>
<td>coding</td>
</tr>
</table>
</body>
</html>