css固定table表头
.table-container { width: 100%; height: 100%; overflow: auto; } /* 首列固定 */ .table-container thead tr > th:first-child, .table-container tbody tr > td:first-child { position: sticky; left: 0; z-index: 1; } /* 表头固定 */ .table-container thead tr > th { position: sticky; top: 0; z-index: 2; } /* 表头首列强制最顶层 */ .table-container thead tr > th:first-child { z-index: 3; }