固定< in< table> [英] Fixed <thead> in <table>

查看:188
本文介绍了固定< in< table>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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>

我想上面的表格的高度为50px,所以滚动条会在内容增长,但我也喜欢表头(thead)固定在上面,而其他内容可以滚动。有没有解决方案,最好使用jQuery?

I'd like the above table to be of 50px height so the scrollers would kick in when the content grows, but I'd also like table headers (thead) to be fixed always on top, while other content can be scrollable. Is there an solution, preferable using jQuery?

先感谢您的帮助。

推荐答案

尝试此帖子: jQuery可滚动,可排序,可过滤的表

它看起来像他们有你需要的(这是一个可冻结,可滚动的jquery表)。

It looks like they've got what you need (which is a freezable, scrollable jquery table).

这篇关于固定&lt; in&lt; table&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆