zoukankan      html  css  js  c++  java
  • table中设置thead固定,tbody 垂直滚动条

    html:

    <div class="fixed-table">
        <div class="fixed-table-header"></div>
        <div class="fixed-table-content">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th><div class="th-inner">a</div></th>
                    <th><div class="th-inner">s</div></th>
                    <th><div class="th-inner">d</div></th>
                    <th><div class="th-inner">f</div></th>
                    <th><div class="th-inner">g</div></th>
                    <th><div class="th-inner">h</div></th>
                    <th><div class="th-inner">j</div></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>asdf</td>
                    <td>asdf</td>
                    <td>asdf</td>
                    <td>asdf</td>
                    <td>asdf</td>
                    <td>asdf</td>
                    <td>asdf</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    css:

    /* table scroll */
    .fixed-table {
        position: relative;
        margin-bottom: 10px;
    }
    .fixed-table-header {
        position: absolute;
        top: 0;
        width: 100%;
        height: 33px;
        background-color: #eee;
        border-bottom: 1px solid #ddd;
    }
    .fixed-table-content {
        height: 200px;
        overflow-y: auto;
    }
    .fixed-table-content table .th-inner {
        position: absolute;
        top: 0;
        height: 33px;
        line-height: 33px;
    }
    .th-inner:not(:first-child) {
        border-left: 1px solid #ddd;
    }
    .fixed-table-content .table>tbody>tr>td {
        padding-left: 8px;
    }
  • 相关阅读:
    二极管常用
    金属化孔与非金属化孔
    电容~3.钽电容
    电感~2.电路分析
    交流整流之后
    电容~2.电路分许
    三极管~3常见电路
    三极管~2.电路分析
    名词解释
    硬件设计
  • 原文地址:https://www.cnblogs.com/miny-simp/p/8366280.html
Copyright © 2011-2022 走看看