jquery制作一个三线表
时间: 2023-11-28 18:44:06 浏览: 45
以下是使用jQuery制作一个三行表的示例代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>三行表</title>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<style type="text/css">
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
border-bottom: 1px solid #ddd;
}
tr:hover {
background-color: #f5f5f5;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>20</td>
<td>男</td>
</tr>
<tr>
<td>李四</td>
<td>22</td>
<td>女</td>
</tr>
<tr>
<td>王五</td>
<td>25</td>
<td>男</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function(){
$("table").addClass("table");
$("th").addClass("thead-dark");
});
</script>
</body>
</html>
```