位置:粘性不适用于Chrome中的某些表格元素(thead / tr)。您可以将粘性移至需要保持粘性的tds / th。像这样:
.table { thead tr:nth-child(1) th{ background: white; position: sticky; top: 0; z-index: 10; }}这也将起作用。
.table { position: sticky; top: 0; z-index: 10;}您可以将标题移动到单独的布局。例如:
<table > <thead> <tr> <th>1</th> <th>2</th> <th>3</th> <th>4</th> </tr> </thead></table><table> <tbody> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr></table>



