zoukankan      html  css  js  c++  java
  • html 表格head头部不动 body部分滚动,每格宽同内容增加

    如下图同Excel表格首行固定:

    <style>
    .table{     100%;    border-collapse:collapse;    border-spacing:0;}

    .table thead{display: block; width: 100%; background: #ddd;}
    .table tbody
    {display: block; height:70px; overflow: auto; width: 100%; border: 1px solid #ddd;}
    .table td,.table th
    { width: 200px; border-bottom: none; border-left: none; border-right: 1px solid #CCC; border-top: 1px solid #DDD; padding: 2px 3px 3px 4px }
    .table tr
    { border-bottom: 1px solid #B74; } </style>
    <table class="table">
                    <thead>
                    <tr>
                        <th>header</th>
                        <th>header two</th>
                        <th>header two</th>
                        <th>header two</th>
                        <th>header two</th>
                        <th>header two</th>
                    </tr>
                    </thead>
                    <tbody class="M_scrollBar">
                    <tr>
                        <td>fuck 1</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                    </tr>
                    <tr>
                        <td>fuck 1</td>
                        <td>fuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>k 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                    </tr>
                    <tr>
                        <td>fuck 1</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                    </tr>
                    <tr>
                        <td>fuck 1</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                        <td>fuck 2</td>
                    </tr>
                    </tbody>
                </table>
  • 相关阅读:
    跑步前后吃什么?
    英雄杀八人场心得
    如何判断JavaScript数据具体类型
    js实现时间日期的格式化
    各个公司前端笔试题回顾
    原型模式Prototype,constructor,__proto__详解
    二级菜单不同方法的实现
    秋招笔试碰到的疑难题目1
    php和mysql学习问题笔记
    es6学习笔记12--Class
  • 原文地址:https://www.cnblogs.com/xiangsj/p/5889106.html
Copyright © 2011-2022 走看看