CSS自定义滚动条样式
测试html内容
DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document
title>
head> <body> <div class="test"> 测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条测试滚动条
div>
body>
html>
默认样式
.test{
height: 200px; width: 200px; background-color: aquamarine; padding: 5px; overflow: auto; }
默认样式效果

自定义后样式
/*滚动条整体样式,高宽分别对应横竖滚动条的尺寸*/ .test::-webkit-scrollbar {
width: 2px; height: 2px; scrollbar-arrow-color:#; } /*滚动条里面小方块*/ .test::-webkit-scrollbar-thumb {
border-radius: 5px; -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); background: rgba(0,0,0,0.2); scrollbar-arrow-color:#; } /*滚动条里面轨道*/ .test::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); border-radius: 0; background: rgba(0,0,0,0.1); }
自定义样式效果

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/179320.html原文链接:https://javaforall.net
