给表格的tbody加滚动条,滚动条美化

html页面

<div id="toolListDiv">
    <table id="toolListTable">
        <thead>
            <tr>
                <th>序号</th>
                <th>工具</th>
                <th>动能</th>
                <th>功能</th>
                <th>时间</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>        

设置样式

/** div */
#toolListDiv{position: absolute;top:50%;width:50%;height:28%;}
/** 表格 */
#toolListTable{top: 25%;left: 1%;width: 97%;font-size: 14px;position: absolute;height:75%;}
/** 表头 width: calc( 100% - 1em )*/
#toolListTable thead{color:#2ae3fb;width: calc( 100% - 1em )}
/** tbody overflow-y: auto;display: block;height:80%; **/
#toolListTable tbody{color:#96a0b8;overflow-y: auto;display: block;height:80%;}
/** display:table;width:100%;table-layout:fixed; */
table thead, tbody tr {display:table;width:100%;table-layout:fixed;}

滚动条美化

/** 滚动条 */
::-webkit-scrollbar {width: 0.7%;}
::-webkit-scrollbar-thumb{background: #2ae3fb;min-height: 1%;border-radius: 10px;opacity: 0.6%;}
/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);border-radius: 10px;/*滚动条的背景区域的圆角*/background-color: transparent;/*滚动条的背景颜色*/}
::-webkit-scrollbar-thumb:vertical:hover{background: #82fbf8;}
::-webkit-scrollbar-thumb:horizontal:hover{background: #82fbf8;}

::-webkit-scrollbar 滚动条整体部分
::-webkit-scrollbar-thumb 滚动条里面的小方块,能向上向下移动(或往左往右移动,取决于是垂直滚动条还是水平滚动条)
::-webkit-scrollbar-track 滚动条的轨道(里面装有Thumb)
::-webkit-scrollbar-button 滚动条的轨道的两端按钮,允许通过点击微调小方块的位置。
::-webkit-scrollbar-track-piece 内层轨道,滚动条中间部分(除去)
::-webkit-scrollbar-corner 边角,即两个滚动条的交汇处
::-webkit-resizer 两个滚动条的交汇处上用于通过拖动调整元素大小的小控件

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值