2016-11-22 84 views
-5

我需要使用条形表(boostrap),但需要滚动。在我的代码中,我只是调用类表表格,并且表格看起来很好。现在我需要为保持相同样式的同一张表添加滚动条。这是可行的吗?怎么样?我可以在html中添加滚动条纹表(boostrap)吗?

下面是我的一些代码

<div class="row col-sm-12"> 
<div class="col-sm-7"> 
    <div class="table-responsive"> 
    <table class="table table-hover table-striped"> 
    <thead> 
<tr> 
    <th>Make</th> 
    <th>Model</th> 
    <th>Color</th> 
    <th>Year</th> 
</tr> 
</thead> 
<tbody> 
<tr> 
    <td class="filterable-cell">Ford</td> 
    <td class="filterable-cell">Escort</td> 
    <td class="filterable-cell">Blue</td> 
    <td class="filterable-cell">2000</td> 
</tr> 
<tr> 
    <td class="filterable-cell">Ford</td> 
    <td class="filterable-cell">Escort</td> 
    <td class="filterable-cell">Blue</td> 
    <td class="filterable-cell">2000</td> 
</tr> 
     <tr> 
    <td class="filterable-cell">Ford</td> 
    <td class="filterable-cell">Escor</td> 
    <td class="filterable-cell">Blue</td> 
    <td class="filterable-cell">2001</td> 
</tr> 
</tbody> 
</table> 
    </div>   
    </div> 
    </div> 

我不知道在哪里可以找到CSS代码。我使用了一个boostrap模板。

+0

你能告诉我们一些代码吗? –

+0

我还添加了桌子和桌子胡佛班。所以我需要保留我提到的所有三种风格。 –

+0

请修改并添加你的代码并添加注释 –

回答

0

设置的高度和溢出-Y:滚动你的风格

table { 
    height: 30px; 
    overflow-y: scroll; 
} 

时的数据加载和空间是不够的数据,表将显示滚动。

<table style="border: 1px solid red"> 
    <thead> 
     <tr> 
      <td>Header stays put, no scrolling</td> 
     </tr> 
    </thead> 
    <tbody style="display: block; border: 1px solid green; height: 30px; overflow-y: scroll"> 
     <tr> 
      <td>cell 1/1</td> 
      <td>cell 1/2</td> 
     </tr> 
     <tr> 
      <td>cell 2/1</td> 
      <td>cell 2/2</td> 
     </tr> 
     <tr> 
      <td>cell 3/1</td> 
      <td>cell 3/2</td> 
     </tr> 
    </tbody> 
</table> 
+0

在标记中复制以下内容 – Dilshan

+0

style =“height:30px; overflow-y:scroll” 根据需要更改高度 – Dilshan

相关问题