修复了<table>中的<thead>

3zz*_*zzy 5 html css jquery

<table border="1" style="height:50px; overflow:auto;">
  <thead>
    <tr>
      <th>Col 1
      </th>
      <th>Col 2
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Cell 3
      </td>
      <td>Cell 4
      </td>
    </tr>
    <tr>
      <td>Cell 5
      </td>
      <td>Cell 6
      </td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我希望上面的表格高度为50px,因此滚动条会在内容增长时启动,但我也喜欢将表头(thead)固定在顶部,而其他内容可以滚动.是否有解决方案,最好使用jQuery?

在此先感谢您的帮助.

小智 6

发现自己需要类似的功能.找不到任何简单明了的东西,所以我自己创建了插件:TH Float jQuery Plugin

我希望有人发现它有用.


Mar*_*ope 2

试试这篇文章:jQuery 可滚动、可排序、可过滤表

看起来他们已经得到了你需要的东西(这是一个可冻结、可滚动的 jquery 表)。