CSS3滚动条美化,CSS3滚动条皮肤

本文介绍如何使用-webkit-scrollbar属性来定制网页中滚动条的样式,包括背景颜色、边框半径等,提供了5种不同的滚动条皮肤样式示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SS3 -webkit-scrollbar滚动条皮肤美化实现,利用-webkit-scrollbar,-webkit-scrollbar-track,-webkit-scrollbar-thumb这2个属性设置不同样式的滚动条。

下面是5个滚动条样式。

css代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.test1::-webkit-scrollbar {
 width8px;
}
 .test1::-webkit-scrollbar-track {
 background-color:#808080;
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
 .test1::-webkit-scrollbar-thumb {
 background-color:#ff4400;
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
.test2::-webkit-scrollbar {
 width8px;
}
 .test2::-webkit-scrollbar-track {
 background-color:#fff;
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
 border:1px solid #ccc;
}
 .test2::-webkit-scrollbar-thumb {
 background-color#F90;
 background-image: -webkit-linear-gradient(45deg,  rgba(255255255, .425%,  transparent 25%,  transparent 50%,  rgba(255255255, .450%,  rgba(255255255, .475%,  transparent 75%,  transparent);
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
.test3::-webkit-scrollbar {
 width12px;
}
 .test3::-webkit-scrollbar-track {
 background-color:#f5f5f5;
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
 .test3::-webkit-scrollbar-thumb {
 border-radius: 10px;
 background-color#FFF;
 background-image: -webkit-gradient(linear,  40% 0%,  75% 84%,  from(#4D9C41),  to(#19911D),  color-stop(.6#54DE5D));
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
.test4{
    width:500px;
    overflow:scroll !important;
    width:600px;
}
.test4>div{
    width:1000px;
}
.test4::-webkit-scrollbar {
 width12px;
 height:12px;
}
 .test4::-webkit-scrollbar-track {
 background-color:#f5f5f5;
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
 .test4::-webkit-scrollbar-thumb {
 border-radius: 10px;
 background-color#F90;
  background-image: -webkit-linear-gradient(90deg,  rgba(255255255, .425%,  transparent 25%,  transparent 50%,  rgba(255255255, .450%,  rgba(255255255, .475%,  transparent 75%,  transparent);
 -webkit-border-radius: 2em;
 -moz-border-radius: 2em;
 border-radius:2em;
}
.test5::-webkit-scrollbar {
 width12px;
 height:12px;
}
 .test5::-webkit-scrollbar-track {
 background-color:#f5f5f5;
 
}
 .test5::-webkit-scrollbar-thumb {
 background-color#d52828;
}

彭亚欧个人博客原创文章,转载请注明出处



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值