我制作了一个带有固定表头的表,该表头在到达表的底部时停止。我用overflow: hidden;放入div中。我有一切可以工作的地方,但并不是我所喜欢的100%。

<div class="container">
  <table class="tableWithFloatingHeader">
    <thead>
     <tr>
       <th>table1 col header</th>
       <th>table1 col header</th>
    </tr>
    <tr>
       <th>table1 col header2</th>
       <th>table1 col header2</th>
    </tr>
   </thead>
   <tbody>

       .............

   </tbody>
  </table>
</div>


问题是:


我似乎也无法将<thead>中的所有内容都向下滚动。
    只有第一行(第一行<tr>)。
只有在以下情况下才能看到div中可见的<th>
    向下滚动。
如何将控制器放在div旁边?在更大的
显示器,它的位置很远(因为这个'left': '20px'


这是我JSFIDDLE的链接

这是我的控制器的html

<div id="compare-table-controller">
                    <a href="javascript:void(0);" class="carousel-control left disabled " data-control="prev">&lsaquo;</a>
                    <a href="javascript:void(0);" class="carousel-control right " data-control="next">&rsaquo;</a>
</div>

最佳答案

Demo

width: 700px更改为width: 100%您可以更改left值,例如宽度值(百分比值)

关于javascript - 在溢出的隐藏div中 float <thead>,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18978715/

10-11 23:25
查看更多