HTML:
html
<table class="layui-table cic-table">
<thead>
<tr>
<td class="td-title"></td>
<td class="td-title row-title"></td>
</tr>
</thead>
<tbody>
<tr>
<td class="td-title"></td>
<td class="first-title"></td>
</tr>
</tbody>
</table>
CSS:
css
.cic-table tbody {
max-height: 330px;
display: block;
overflow-y: auto;
}
.cic-table thead, .cic-table tbody tr {
width: 100%;
display: table;
table-layout: fixed;
}
.cic-table thead {
width: calc(100% - 3px); /*减去默认滚动条的宽度,让thead 与tbody 对齐*/
}
/*改变滚动条的宽度和样式*/
.cic-table tbody::-webkit-scrollbar { width: 3px;}
.cic-table tbody::-webkit-scrollbar { width: 3px;}
.cic-table tbody::-webkit-scrollbar-track{background-color:#f0f0f0;}
.cic-table tbody::-webkit-scrollbar-thumb{background-color:#CCCCCC;}
.cic-table tbody::-webkit-scrollbar-thumb:hover {background-color:#CCCCCC;}
.cic-table tbody::-webkit-scrollbar-thumb:active {background-color:#CCCCCC;}