效果图:

table表格布局,表头固定不动,表身超出可滑动


HTML:

<table class="tablehead">
    <tr>
        <td style="width:40px;">序号</td>
        <td>品名</td>
        <td style="width:150px;">货号</td>
        <td style="width:100px;">原价</td>
        <td style="width:100px;">单价</td>
        <td style="width:100px;">数量</td>
        <td style="width:200px;">小计</td>
        <td style="width:136px;">操作</td>
    </tr>
</table>
<div class="tablebodyBox">
    <table class="tablebody">

        <td style="width:40px;">序号</td>
        <td>品名</td>
        <td style="width:150px;">货号</td>
        <td style="width:100px;">原价</td>
        <td style="width:100px;">单价</td>
        <td style="width:100px;">数量</td>
        <td style="width:200px;">小计</td>
        <td style="width:120px;">操作</td>

    </table>
</div>

CSS:


.tablehead {
        table-layout:fixed;
        clear:both;
        width:100%;
        height:40px;
        border:#ccc 1px solid;
        margin-top:10px;
        background-color:#eee;
    }
    .tablebody {
        table-layout:fixed;
        clear:both;
        width:100%;
        margin-top:-1px;
    }
    table td {
        border:#ccc 1px solid;
        text-align:center;
    }
    table tr {
        width:100%;
        height:40px;
    }

    .tablebodyBox {
        overflow-x: hidden;
        width:100%;
        overflow-y:scroll;
        border-bottom:1px solid #ccc;
    }

相关文章:

  • 2022-12-23
  • 2021-08-16
  • 2021-08-07
  • 2021-12-31
  • 2021-12-31
  • 2021-12-28
  • 2021-12-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案