问题描述:

i have a div with overflow scroll and i want to change style of scrollbar like this picture:

How can i change the scrollbar ?

<div id="box" style="overflow:auto; width:200px; height:200px; border:1px solid black;">

1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>

11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>

21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br>

</div>

网友答案:

With these selectors u can customize your scrollbar in CSS...

::-webkit-scrollbar
::-webkit-scrollbar-button
::-webkit-scrollbar-track
::-webkit-scrollbar-track-piece  
::-webkit-scrollbar-thumb
::-webkit-scrollbar-corner
::-webkit-resizer

For example:

::-webkit-scrollbar-track{
    width: 12px;
}

Just try them out

网友答案:
 For IE:
   body {
        scrollbar-face-color: #b46868;
   }

For webkit

::-webkit-scrollbar-track {
  background-color: #b46868;
} /* the new scrollbar will have a flat appearance with the set background color */

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2); 
 } /* this will style the thumb, ignoring the track */

::-webkit-scrollbar-button {
  background-color: #7c2929;
 } /* optionally, you can style the top and the bottom buttons
(left and right for horizontal bars) */

::-webkit-scrollbar-corner {
  background-color: black;
} /* if both the vertical and the horizontal bars appear, then perhaps
the right bottom corner also needs to be styled *

You can change scroll with fleXcroll.

Check this: http://www.hesido.com/web.php?page=customscrollbar

https://webdesign.tutsplus.com/articles/quick-tip-styling-scrollbars-to-match-your-ui-design--webdesign-9430

相关阅读:
Top