【发布时间】:2017-10-03 19:34:29
【问题描述】:
我有一个问题已经回答了很多次,但我的要求是定制的,我想要一个 HTMl 表格,带有固定标题和动态高度和滚动条,以防记录超过 10 条。
I want horizontal scroll bar if table size increases more than 100% width.
Vertical scroll bar needed if table has records more than 10 .
But if table has less than 10 records than the size of the table
should not be fixed up to 10 rows.
I found lots solutions but table height is being fixed there to achieve scroll.
下面是我的 HTML 代码
<div class="table-responsive custom-table-responsive">
<table id="demo_datatables" class="table table-bordered table-striped stripe hover row-border">
<thead class ="div-head" >
<tr>
<th><b>Stage</b></th>
<th><b>Site</b></th>
<th><b>Resource Name</b></th>
<th><b>APS Relevant</b></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
And CSS Used here is as below
.custom-table-responsive {
overflow: auto;
height: 400px;
}
【问题讨论】:
-
您希望我们为您制作??
-
这不是一个编码服务——请解释一下你到目前为止所做的尝试,并展示一些代码。
-
您的问题中没有代码,所以请用您尝试过的代码更新您的问题
-
现在建议我是否有任何解决方案
标签: javascript jquery css html