css控制table首列固定内容滚动

        table tbody {
            display: block;
            height: 500px;
            overflow-y: scroll;
        }

        table thead, tbody tr {
            display: table;
            width: 100%;
            table-layout: fixed;
            box-sizing: border-box;
        }


        table thead {
            width: calc( 100% - 17px );
            background-color: #ddd;
        }

 

<table id="tblist" class="layui-table" border="1" cellpadding="1" cellspacing="0">
                        <colgroup>
                            <col>
                        </colgroup>
                        <thead>
                            <tr>
                                <th>模块</th>
                                <th>子模块</th>
                                <th>权限</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>贤心</td>
                                <td>2016-11-29</td>
                                <td>人生就像是一场修行</td>
                            </tr>
                            <tr>
                                <td>许闲心</td>
                                <td>2016-11-28</td>
                                <td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
                            </tr>
                        </tbody>
                    </table>

 

posted @ 2023-10-30 12:13  妖狐鬼魅  阅读(59)  评论(0编辑  收藏  举报