Styling Browser Scrollbar

后端 未结 6 971
无人及你
无人及你 2021-02-09 17:38

I saw this years before, but since it was not widely supported, websites are dropping usage of it.

I am currently designing a website which will have scrollbars inside t

相关标签:
6条回答
  • 2021-02-09 17:59

    You can do it like this:

    <style>
    body {
        scrollbar-face-color: #000000;
        scrollbar-highlight-color: #000000;
        scrollbar-shadow-color: #000000;
        scrollbar-3dlight-color: #000000;
        scrollbar-arrow-color: #000000;
        scrollbar-track-color: #000000;
        scrollbar-darkshadow-color: #000000;
    }
    </style>
    

    but it only works in Internet Explorer and Opera (thanks, Julien!). And you might want to use different colours. 8-)

    0 讨论(0)
  • 2021-02-09 17:59

    many browsers support some sort of styling the scrollbars, but nothing of it is standardised in css.

    also, as arve systad said, changing such basic widgets of the OS is a no-go—though one should be careful with changing buttons then too

    0 讨论(0)
  • 2021-02-09 18:05

    A JavaScript solution can be found at http://www.hesido.com/web.php?page=customscrollbar. Note that you do have to pay for this, but even if you don't want to go that route it shows what is possible.

    Otherwise a jQuery solution and a Prototype solution are also available.

    0 讨论(0)
  • 2021-02-09 18:10

    I quote myself from this thread, since it's related:

    From a usability point of view, changing scroll bars is a no-go. The user is familiar with his/her operating system and the visual environment it provides. Changing this does create confusion, especially among those who are new to using computers, old people etc.

    The majority of users today will probably recognize a scroll bar as long as it has it's basic shape - and many will not even use the bar itself, but just the scroll wheel on the mouse.

    It's still a thing to think about though. Consider your audience. And whatever you do make sure it actually works on all platforms/in all browsers if you use a custom scroll bar.

    0 讨论(0)
  • 2021-02-09 18:12

    WebKit supports another mechanism.

    0 讨论(0)
  • 2021-02-09 18:19

    I haven't gotten around to trying these solutions, but they do look very promising and are claimed to degrade nicely.

    This would be my first choice
    http://www.hesido.com/web.php?page=customscrollbar

    http://www.n-son.com/scripts/jsScrolling/new/example5.html

    0 讨论(0)
提交回复
热议问题