Custom CSS Scrollbar for Firefox

后端 未结 10 2514
遥遥无期
遥遥无期 2020-11-22 02:23

I want to customize a scrollbar with CSS.

I use this WebKit CSS code, which works well for Safari and Chrome:

::-webkit-scrollbar {
    width: 15px;
         


        
10条回答
  •  Happy的楠姐
    2020-11-22 02:47

    May I offer an alternative?

    No scripting whatsoever, only standardized css styles and a little bit of creativity. Short answer - masking parts of the existing browser scrollbar, which means you retain all of it's functionality.

    .scroll_content {
        position: relative;
        width: 400px;
        height: 414px;
        top: -17px;
        padding: 20px 10px 20px 10px;
        overflow-y: auto;
    }
    

    For demo and a little bit more in-depth explanation, check here...

    jsfiddle.net/aj7bxtjz/1/

提交回复
热议问题