css修改滚动条默认样式
文章目录
页面HTML:
1 <div class="inner">
2 <div class="innerbox">
3 <p style="height:200px;">这是内容111</p>
4 <p style="height:400px;">这里是内容222</p>
5 <p>这里是内容333</p>
6 </div>
7 </div>
css代码:
1 .inner{
2 width: 265px;
3 height: 400px;
4 position: absolute;
5 top: 33px;
6 left: 13px;
7 /*cursor: pointer;*/
8 overflow:hidden;
9 }
10 .innerbox{
11 overflow-x: hidden;
12 overflow-y: auto;
13 color: #000;
14 font-size: .7rem;
15 font-family: "\5FAE\8F6F\96C5\9ED1",Helvetica,"黑体",Arial,Tahoma;
16 height: 100%;
17 }
18 /*滚动条样式*/
19 .innerbox::-webkit-scrollbar {/*滚动条整体样式*/
20 width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
21 height: 4px;
22 }
23 .innerbox::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
24 border-radius: 5px;
25 -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
26 background: rgba(0,0,0,0.2);
27 }
28 .innerbox::-webkit-scrollbar-track {/*滚动条里面轨道*/
29 -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
30 border-radius: 0;
31 background: rgba(0,0,0,0.1);
32 }
转载于猿2048:➩《css修改滚动条默认样式》

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论