Home > Web Front-end > CSS Tutorial > How to set scroll bar transparent in css

How to set scroll bar transparent in css

王林
Release: 2023-01-06 11:13:18
Original
6524 people have browsed it

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.

How to set scroll bar transparent in css

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;
}
Copy after login

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template