bootstrap 表头固定

原文地址

效果

bootstrap-table.png

css:



//表头固定

.fixed_headers thead tr {

    display: block;
    position: relative;
}
.fixed_headers tbody {
    display: block;
    overflow: auto;
    height: 250px;
}
//每列宽度

.fixed_headers td:nth-child(1),
.fixed_headers th:nth-child(1) {

    min-width: 250px;
    text-overflow:ellipsis;
    white-space:nowrap;
    overflow:hidden;
}
.fixed_headers td:nth-child(2),
.fixed_headers th:nth-child(2) {
    min-width: 200px;
}
.fixed_headers td:nth-child(3),
.fixed_headers th:nth-child(3) {
    min-width: 200px;
}
.fixed_headers td:nth-child(4),
.fixed_headers th:nth-child(4) {
    min-width: 200px;
}
.fixed_headers td:nth-child(5),
.fixed_headers th:nth-child(5) {
    min-width: 200px;
}
.fixed_headers td:nth-child(6),
.fixed_headers th:nth-child(6) {
    min-width: 200px;
}
.fixed_headers td:nth-child(7),
.fixed_headers th:nth-child(7) {
    min-width: 200px;
}
.fixed_headers td:nth-child(8),
.fixed_headers th:nth-child(8) {
    min-width: 200px;
}

html:

<table class="table  table-hover coma-base-table fixed_headers">
    <thead>
    <tr style="white-space: nowrap">
        <th  style="font-weight: bold;">被参控公司</th>
        <th  style="font-weight: bold;">参控关系</th>
        <th  style="font-weight: bold;">直接持股比例</th>
    </tr>
    </thead>
    <tbody>
         ..........
    </tbody>
</table>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,641评论 25 708
  • 存在仓库灰尘落满的饼干盒子 掉漆风化的积木小汽车 各种原因穿不下衣物 罕见早起雨露清晨的凉风和微热的阳光 心中的山...
    酷酷的娇娇啊阅读 172评论 0 0