The way to set the scroll bar to be transparent in css is to add the style [::-webkit-scrollbar {height: 0;width: 0;color: transparent;}] to the scroll bar.
The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.
We can achieve the scroll bar transparency effect by setting the following style:
::-webkit-scrollbar { height: 0; width: 0; color: transparent; }
Customize the scroll bar height and color
/*定义滚动条样式(高宽及背景)*/ ::-webkit-scrollbar { width: 6px; /* 滚动条宽度, width:对应竖滚动条的宽度 height:对应横滚动条的高度*/ background: #007acc; } /*定义滚动条轨道(凹槽)样式*/ ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); /* 较少使用 */ border-radius: 3px; } /*定义滑块 样式*/ ::-webkit-scrollbar-thumb { border-radius: 3px; height: 100px; /* 滚动条滑块长度 */ background-color: #ccc; }
Learning video sharing: css video tutorial
The above is the detailed content of How to set scroll bar transparent in css. For more information, please follow other related articles on the PHP Chinese website!