我必须用滚动条制作这个表格内容(tbody),表格的高度是固定的。为了启用滚动,我添加了样式display: block。之后,表格的宽度被冻结且不可调整。给我找个办法让表格的宽度变满。
HTML:
<table class="table table-striped table-hover" id="item_table">
<thead>
<tr class="bg-primary">
<th>#</th>
<th>Product Name</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Discount</th>
<th>Amount</th>
<th><i class="fa fa-close"></i></th>
</tr>
</thead>
<tbody id="item_list">
<tr>
<td>1</td>
<td>Mens Full Sleeve Shirts</td>
<td>1</td>
<td>2200.00</td>
<td>200.00</td>
<td>2000.00</td>
<td><span><i class="fa fa-trash"></i></span></td>
</tr>
</tbody>
</table>
CSS:
#item_table{
display: table-row;
table-layout:fixed;
}
#item_list{
width: 100%;
display: block;
table-layout:fixed;
height: 170px;
overflow-y: scroll;
}
