<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css">
<script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>
<style>
table {
position: relative;
}
table thead,
table tbody tr {
display: table;
width: 100%;
table-layout: fixed;
text-align: center;
}
table tbody tr {
box-sizing: border-box;
}
table thead {
width: calc(100% - 1.3em);
position: absolute;
z-index: 99
}
table tbody {
display: block;
height: 500px;
overflow-y: scroll;
overflow-x: auto;
padding-top: 40px;
box-sizing: border-box;
border-bottom: 1px solid #e6e6e6
}
</style>
</head>
<body>
<div class="layui-card-body" id="divContent" style="padding-bottom: 0px">
<div class="table-container">
<table class="layui-table">
<thead>
<tr>
<th>姓名</th>
<th>角色</th>
<th>年龄</th>
<th>出生日期</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>管理员</td>
<td>9</td>
<td>2019-01-01T00:00:00</td>
</tr>
<tr>
<td>李四</td>
<td>超级管理员</td>
<td>21</td>
<td>2020-01-01T00:00:00</td>
</tr>
<tr>
<td>王五</td>
<td>系统管理员</td>
<td>22</td>
<td>2021-01-01T00:00:00</td>
</tr>
<tr>
<td>11</td>
<td>11</td>
<td>11</td>
<td>2021-12-13T14:03:12.417</td>
</tr>
<tr>
<td>22</td>
<td>22</td>
<td>22</td>
<td>2021-12-13T14:03:16.667</td>
</tr>
<tr>
<td>33</td>
<td>33</td>
<td>33</td>
<td>2021-12-13T14:03:33.033</td>
</tr>
<tr>
<td>44</td>
<td>44</td>
<td>44</td>
<td>2021-12-13T14:03:37.913</td>
</tr>
<tr>
<td>55</td>
<td>55</td>
<td>55</td>
<td>2021-12-13T14:03:42.283</td>
</tr>
<tr>
<td>66</td>
<td>66</td>
<td>66</td>
<td>2021-12-13T14:03:45.967</td>
</tr>
<tr>
<td>77</td>
<td>77</td>
<td>77</td>
<td>2021-12-13T14:03:50.337</td>
</tr>
<tr>
<td>88</td>
<td>88</td>
<td>88</td>
<td>2021-12-13T14:03:54.467</td>
</tr>
<tr>
<td>99</td>
<td>99</td>
<td>99</td>
<td>2021-12-13T14:03:58.67</td>
</tr>
<tr>
<td>100</td>
<td>100</td>
<td>100</td>
<td>2021-12-13T14:04:07.317</td>
</tr>
<tr>
<td>101</td>
<td>102</td>
<td>103</td>
<td>2021-12-13T14:04:17.823</td>
</tr>
<tr>
<td>105</td>
<td>105</td>
<td>105</td>
<td>2021-12-13T14:04:32.1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>2021-12-13T14:04:37.583</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>2</td>
<td>2021-12-13T14:04:41.8</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>3</td>
<td>2021-12-13T14:04:49.717</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
<td>4</td>
<td>2021-12-13T14:04:53.833</td>
</tr>
<tr>
<td>66z</td>
<td>5</td>
<td>5</td>
<td>2021-12-13T14:05:00.35</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>
普通表格头部固定
最新推荐文章于 2024-07-25 14:21:05 发布