請參考此鏈接,例如:CLICK HERE改變滾動條風格
我使用的是下面的CSS改變滾動條:
/* For the "inset" look only */
html {
overflow: auto;
}
body {
position: absolute;
top: 20px;
left: 20px;
bottom: 20px;
right: 20px;
padding: 30px;
overflow-y: scroll;
overflow-x: scroll;
}
/* Let's get this party started */
::-webkit-scrollbar {
width: 6px;
}
/* Track */
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 6px;
border-radius: 6px;
}
/* Handle */
::-webkit-scrollbar-thumb {
-webkit-border-radius: 6px;
border-radius: 6px;
background: rgba(255,0,0,0.8);
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255,0,0,0.4);
}
這個CSS只更改Y滾動的寬度,我如何更改x滾動的寬度。
請幫我解決這個問題。
你知道這是一個propietary風格僅適用於Chrome瀏覽器?你知道最後的滾動條對眼睛來說是醜陋的嗎?我推薦一個js滾動條,如果你真的需要風格化它:Perfect Scrollbar(https://noraesae.github.io/perfect-scrollbar/)你可以用你想要的所有css來設計風格 –
':: - webkit-scrollbar {height :12像素;}'會的工作,但我同意@MarcosPérezGude,你應該去JS滾動 –
@AbhishekPandey,由於這是爲我工作,當我添加一個'高度:6像素;' –