因此,进入页面时滚动条不会显示,只有在使用鼠标滚动时才会显示我已经试着说:z指数:10
溢出:滚动
重要
但是没有一个工作,它仍然有同样的错误,我不知道它可能是什么。我在版本1.4.0 中使用plugin-perfect-scrollbar.scss
集装箱
.ps {
background-color: aqua;
}
滚动条
.ps__rail-x {
display: none;
opacity: 1 !important;
transition: background-color .2s linear, opacity .2s linear;
-webkit-transition: background-color .2s linear, opacity .2s linear;
height: 15px;
/* there must be 'bottom' or 'top' for ps__rail-x */
bottom: 0px;
/* please don't change 'position' */
position: absolute;
}
.ps__rail-y {
display: none;
opacity: 1 !important;
transition: background-color .2s linear, opacity .2s linear;
-webkit-transition: background-color .2s linear, opacity .2s linear;
width: 15px;
/* there must be 'right' or 'left' for ps__rail-y */
right: 0;
/* please don't change 'position' */
position: absolute;
}
您必须设置overflow: scroll;
,然后才能通过在CSS中添加::-webkit-scrollbar
来插入手动滚动条。含义-只要有滚动条或overflow: scroll;
,这些样式就会生效。
下面的迷你演示:
div {
border: solid black 1px;
width: 300px;
height: 40px;
overflow: scroll;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 10px 10px #ffd110;
}
::-webkit-scrollbar-thumb {
box-shadow: inset 0 0 10px 10px black;
}
<div>
<p>DIVDIVDIVDIVDIVDIVDIVDIVDIV<br>DIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIVDIV</p>
</div>