我正试图创建一个固定的头引导表与CSS。
- CSS**
table.scroll tbody, table.scroll thead {
display: block;
}
table.scroll tbody {
height: 600px;
overflow-y: auto;
overflow-x: hidden;
}
- HTML**
<table id="standart_list" class="table table-bordered scroll">
<thead>
<tr>
<th>Standart Kodu</th>
<th>Standart Tanımı</th>
<th>Standart(Asgari Şart)</th>
<th>Standart Durum Karşılanıyor Mu?</th>
<th>Mevcut Durum</th>
<th>Açıklama</th>
</tr>
</thead>
<tbody>
<tr bgcolor="#7fffd4">
<td>
ADLİ TIP
</td>
</tr>
<tr>
<input type="hidden" name="brans_2882" value="2">
<td>
2.1.1
</td>
<td style="max-width: 600px">
EĞİTİCİ SAYISI
</td>
<td>
1
</td>
<td>
<select name="select_2882" id="select_2882" class="form-control">
<option value="1">Evet</option>
<option value="0" selected="">Hayır</option>
</select>
</td>
<td>
<input type="text" name="input_2882" id="input_2882" value="0" class="form-control mevcut_durum numeric" required="">
<span class="errmsg"></span>
</td>
<td>
<textarea name="text_2882" id="text_2882" class="form-control aciklama" required="">bu büyüklüğe</textarea>
</td>
</tr>
</tbody>
</table>
<tbody>
看起来不错,滚动也能工作。但是<thead>
元素不与<tbody>
对齐。
我该如何解决这个问题?
下面是屏幕,看起来如所述:
谢谢!
4条答案
按热度按时间rdlzhqv91#
下面的工作在比IE9新的浏览器上,要让它在旧的浏览器中工作,不幸的是,你需要使用固定的列宽。来源:Source page for my answer
30byixjq2#
尝试删除此部分:
imzjd6km3#
我在之前的stackoverflow文章中找到了解决方案。Scrollable table with fixed header in bootstrap在第二条评论中使用解决方案。
另一个解决方案:How to display scroll bar onto a html table
pu82cl6c4#
只需在tabel标记中添加这行代码,它就可以解决这个问题