【发布时间】:2016-01-26 20:08:47
【问题描述】:
我想创建一个包含大量数据的表。为了保持一切顺利,我希望表格可以滚动。我使用引导程序来拉皮条。 我知道以前有人问过这个问题,并且该解决方案确实对我有用,但是我的桌子一团糟。请参阅右侧的表格以了解其外观。我希望它看起来更像左边的桌子。
所以我尝试的是:
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Speciale tarieven buiten 's-Herogenbosch</h3>
<div class="pull-right">
<span class="clickable filter" data-toggle="tooltip" title="Klik om te zoeken"
data-container="body">
<i class="glyphicon glyphicon-search"></i>
</span>
</div>
</div>
<div class="panel-body">
<input type="text" class="form-control" id="task-table-filter" data-action="filter"
data-filters="#task-table" placeholder="Zoek naar een plaats.."/>
</div>
<table class="table table-hover table-fixed" id="task-table">
<thead>
<tr>
<th >#</th>
<th>Van</th>
<th>Naar</th>
<th>Normaal</th>
<th>Onze prijs</th>
<th>Korting</th>
</tr>
</thead>
<tbody class="alignmentp">
<tr>
<td>1</td>
<td>'s-Hertogenbosch</td>
<td>Ammerzoden</td>
<td>€ 35,00-</td>
<td>€ 24,99-</td>
<td>30 %</td>
</tr>
<tr>
<td>2</td>
//etc etc
</tr>
</tbody>
</table>
</div>
我使用的 CSS 是:
.alignmentp{
text-align: left !important;
}
.table-fixed thead {
width: 97%;
}
.table-fixed tbody {
height: 230px;
overflow-y: auto;
width: 100%;
}
.table-fixed thead, .table-fixed tbody, .table-fixed tr, .table-fixed td, .table-fixed th {
display: block;
}
.table-fixed tbody td, .table-fixed thead > tr> th {
float: left;
border-bottom-width: 0;
}
我可以通过手动更正每个 和 元素的宽度和高度来修复此表,但必须有更好的方法来做到这一点..
【问题讨论】:
-
如果从
.alignmentp中删除text-align: left !important;会发生什么?
标签: html css twitter-bootstrap bootstrap-table