css3 - 关于滚动条的CSS如何设置问题
巴扎黑
巴扎黑 2017-04-17 11:19:22
0
4
703
<p id='p3' style='width:200px;height:200px;overflow:auto;'>
        This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.
    </p>

就像上面代码 p里面有一段文字,我设置了overflow:auto;也就是超出部分显示滚动条,那么我如何修改这个滚动条的样式呢?

巴扎黑
巴扎黑

reply all(4)
左手右手慢动作

An example of scroll bar beautification for Webkit browsers, I don’t know if this is what you want

/* 滚动条部分 */
::-webkit-scrollbar {
    width:15px;
}

/* 轨道 */
::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    -webkit-border-radius: 15px;
    border-radius: 15px;
}

/* 手柄 */
::-webkit-scrollbar-thumb {
    -webkit-border-radius: 15px;
    border-radius: 15px;
    background:rgba(200,200,200,0.7); 
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
/* 手柄激活态 */
::-webkit-scrollbar-thumb:window-inactive {
    background: rgba(200,200,200,0.4); 
}
迷茫

Then just define the browser scroll bar style. The two are consistent. If you need it to be different, you need to simulate the scroll bar

Ty80

Recommend you to refer to this article: http://www.qianduan.net/css-custom-scroll-bar-style/
The author is Shenfei of the WeChat team, and the articles he writes are always very good!

伊谢尔伦

Speaking of scrolling, change the scroll bar style. Why can the PC display normally. The mobile version doesn’t work

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template