Jquery 如何使用固定的标题使html表格可滚动?

Jquery 如何使用固定的标题使html表格可滚动?,jquery,Jquery,我有很多行的桌子。我想让它垂直滚动,但有固定的标题。您可以使用CSS使表的元素可滚动 假设你有这样的桌子: <table> <tr> <th>heading 1</th> <th>heading 2</th> </tr> <tr class='scrollable'> <td>cell 1</td> <td>cell 2&

我有很多行的桌子。我想让它垂直滚动,但有固定的标题。

您可以使用CSS使表的元素可滚动

假设你有这样的桌子:

<table>
  <tr>
    <th>heading 1</th>
    <th>heading 2</th>
  </tr>
  <tr class='scrollable'>
    <td>cell 1</td>
    <td>cell 2</td>
  </tr>
</table>

你试过什么吗?试过。我把那张桌子放在这个房间里。但整个表格都可以和标题一起滚动。
.scrollable{ 
    width: 150px;
    height: 150px;
    overflow: scroll;
}