小编Bil*_*lly的帖子

固定表格标题与动态内容?

我找到了几种固定标头的解决方案,但没有一个能解决我的问题。

我有一个表格,采用 jQuery mobile(响应式表格)设计。该表是动态填充的.append。列没有固定的宽度,它们是变化的。有没有办法修复表格的标题,以便我能够滚动表格主体,标题始终显示在顶部,但不使用多个表格。

概括:

我想要一个带有固定标题的表。

我很惊讶没有这方面的标准,因为我认为这是大多数网络开发人员都可以使用的东西。如果我错了,请纠正我。

先感谢您!

编辑:

例子:

<table id="my_id" data-role="table" class="ui-body-d ui-shadow table-stripe
 ui-responsive">
    <thead id="must_be_static">
       <tr>
          <th>This guy should be static</th>
          <th>This guy should be static</th>
          <th>This guy should be static</th>
          <th>This guy should be static</th>
          <th>This guy should be static</th>
       </tr>
    </thead>
    <tbody id="id_for_content">
       <tr>
          <td>Dynamic content</td>
          <td>Dynamic content</td>
          <td>Dynamic content</td>
          <td>Dynamic content</td>
          <td>Dynamic content</td>
       </tr>
    </tbody>
    <tfoot>
       <tr>
          <td>Foot</td>
          <td>Foot</td>
          <td>Foot</td>
          <td>Foot</td>
          <td>Foot</td>
       </tr>
    </tfoot>
</table>
Run Code Online (Sandbox Code Playgroud)

html css jquery jquery-mobile

5
推荐指数
1
解决办法
7615
查看次数

标签 统计

css ×1

html ×1

jquery ×1

jquery-mobile ×1