表格table固定列头

<html>

<head>

<style>

 .table-header-fixed>thead th {

position:sticky;

top:0;

background-color:white;

opacity:1;

z-index:10;

}

</style>

</head>

<body>

<div style="overflow-y:auto;max-height:100px">

<table  class="table-header-fixed">

<thead>

<tr><th>fixed header</th></tr>

</thead>

<tbody>

<tr><td>v1</td></tr>

<tr><td>v2</td></tr>

<tr><td>v3</td></tr>

<tr><td>v4</td></tr>

<tr><td>v5</td></tr>

</tbody>

</table>

</div>

</body>

</html>

相关推荐