相关疑难解决方法(0)

滚动时如何锁定表格的第一行和第一列,可能使用JavaScript和CSS?

当您激活"冻结窗格"时,如何创建一个锁定第一行和第一列的表(如在Excel中)?我需要表格水平和垂直滚动(存在很多解决方案,但只允许垂直滚动).

因此,当您向下滚动表格时,第一行将保持不变,因为它将具有列标题.thead无论是什么使得解决方案变得更容易,这可能最终都会出现,或者可能不会出现.

向右滚动时,第一列保持不变,因为它保存行的标签.

我很确定单独使用CSS是不可能的,但有人能指出我的JavaScript解决方案吗?它需要在所有主流浏览器中工作.

javascript css excel scroll css-tables

31
推荐指数
3
解决办法
10万
查看次数

表 - 固定标题,可滚动主体,最强大/简单的解决方案?

可能重复:
带固定标题的HTML表格?

寻找创建具有可滚动主体和静态/固定标头的表的解决方案.

搜索周围似乎产生了许多片状代码,要么不在IE中工作,需要大量的Javascript和调整,要么是愚蠢的CSS hacks等.

说实话,如果是CSS hacks或Javascript的情况,我想我更喜欢使用Javascript选项.

我猜的另一种选择是将它全部放在一个div中,然后只滚动整个表格 - 但这有点不对劲:D

html javascript css html-table

10
推荐指数
2
解决办法
4万
查看次数

如何制作一个比屏幕尺寸宽,可滚动并保持标题行固定的表格?

我有一个 2列每列800像素宽.我想在800x50窗口中显示此表.所以应该有水平和垂直滚动条来查看完整的表格.

虽然我在SO上找到了很少的相关解决方案(这个这个),但它们只有在表格宽度小于屏幕尺寸时才有效.在我的情况下,屏幕大小为1200像素,总表格宽度为1600像素.

我怎么能这样做?我希望实现这样的目标.

编辑 哎呀,我忘了添加一个要求.抱歉.我希望用户滚动表时表的标题保持固定.

EDIT2

我已经尝试了下面提到的解决方案来包装div,但在这种情况下,垂直滚动条不显示.请用包装器div 查看此表.如果表格宽度大于屏幕尺寸,似乎只会出现此问题.我正在测试FF3.6.

EDIT3

当前代码.即使我可以垂直滚动,也没有垂直滚动条.

<div style="overflow:scroll; width:800px;height:50px" >
<table style="width:1600px" border="1">
  <thead>
    <tr>
        <th style="width:800px">id_1</th>
        <th style="width:800px">id_1</th>
    </tr>
  </thead>
  <tbody style="">
    <tr><td>1200</td><td>1200</td></tr>
    <tr><td>1200</td><td>1200</td></tr>
    <tr><td>1200</td><td>1200</td></tr>
    <tr><td>1200</td><td>1200</td></tr>
    <tr><td>1200</td><td>1200</td></tr>
    <tr><td>1200</td><td>1200</td></tr>
  </tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)

html css html-table width

8
推荐指数
1
解决办法
2万
查看次数

滚动时修复了html表头

我有以下表结构:

<table>   
<thead>   
    <tr>   
        <th colspan="4">Current</th>   
        <th colspan="4">New/Requested</th>   
    </tr>   
    <tr>   
        <th nowrap="nowrap">RSD &nbsp;&nbsp;&nbsp;&nbsp;</th>  
        <th nowrap="nowrap">CRSD &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">MSD &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">Open QTY &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">CRD &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">CRSD &nbsp;&nbsp;&nbsp;&nbsp;</th>  
        <th nowrap="nowrap">MSD &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">Open QTY &nbsp;&nbsp;&nbsp;&nbsp;</th>   
        <th nowrap="nowrap">Action</th>   
        <th nowrap="nowrap">Reason</th>   
        <th nowrap="nowrap">Action Code Status </th>   
    </tr> 
    <tbody>
        <tr>
            <td></td>  
            <td></td>   
            .....plenty of rows
        </tr>
    </tbody>
</thead>   
</table> 
Run Code Online (Sandbox Code Playgroud)

我正在尝试修复标题,以便如果我向下滚动它仍然可见.我查看了这篇文章,但无法理解.我怎样才能做到这一点?

html javascript css jquery html-table

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×4

html ×3

html-table ×3

javascript ×3

css-tables ×1

excel ×1

jquery ×1

scroll ×1

width ×1