天天看點

css滾動條一直顯示不出來,CSS-溢出:滾動;-總是顯示垂直滾動條?

小編典典

我自己就遇到了這個問題。OSx Lion在不使用時會隐藏滾動條,使它看起來更“光滑”,但是同時出現了您解決的問題:人們有時看不到div是否具有滾動功能。

解決方法:在您的CSS中包括-

::-webkit-scrollbar {

-webkit-appearance: none;

width: 7px;

}

::-webkit-scrollbar-thumb {

border-radius: 4px;

background-color: rgba(0, 0, 0, .5);

box-shadow: 0 0 1px rgba(255, 255, 255, .5);

}

::-webkit-scrollbar {

-webkit-appearance: none;

width: 7px;

}

::-webkit-scrollbar-thumb {

border-radius: 4px;

background-color: rgba(0, 0, 0, .5);

box-shadow: 0 0 1px rgba(255, 255, 255, .5);

}

#container {

height: 4em;

overflow-y: scroll;

}

#child {

height: 12em;

}

#container {

background-color: #ffc;

}

#child {

margin: 30px;

background-color: #eee;

text-align: center;

}

Example

2020-05-16