隐藏滚动条轨道但显示滚动条拇指

Mad*_*Max 5 html css scrollbar

晚上好!我只是想像这样改变我的卷轴。 像这样

所以看起来该轨道是隐藏的。我的风格是这样的

::-webkit-scrollbar{
   width: 15px;
   height: 40px;
}

::-webkit-scrollbar-thumb{
   background-color: #DBDBDB;
   border: 4px solid transparent;
   border-radius: 11px;
   background-clip: content-box;
}

::-webkit-scrollbar * {
   background: transparent;
}

::-webkit-scrollbar-thumb:vertical {
   height: 90px;
}
Run Code Online (Sandbox Code Playgroud)

我得到了这样的结果: 结果

所以有一个问题。我怎样才能用 CSS 或 JS 做到这一点?谢谢

kus*_*-aa 3

我认为这可能有效:

::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: transparent;
}
::-webkit-scrollbar-thumb {

    -webkit-border-radius: 10px;

    border-radius: 10px;

    background: rgba(,0,0,0.5); 

    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
Run Code Online (Sandbox Code Playgroud)

您可能需要根据您的需要对其进行编辑。