Mic*_*sby 11 css scrollbar css3
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-thumb {
background-color:#808080;
}
Run Code Online (Sandbox Code Playgroud)
为什么宽度和高度属性不起作用?
Moh*_*sen 24
width用于垂直滚动条并height影响水平滚动条.您无法为垂直滚动条定义高度.这取决于内容大小.
如果要将背景图像添加到滚动条,则会像普通元素一样添加它们:
::-webkit-scrollbar {
width: 50px;
height: 50px;
background:-webkit-linear-gradient(0, blue 50%, white 100%);
}
::-webkit-scrollbar-thumb {
background-color:#808080;
background:url("http://www.topdesignmag.com/wp-content/uploads/2010/12/137.jpg");
}
Run Code Online (Sandbox Code Playgroud)