简体   繁体   English

CSS 3滚动条-添加填充和光标?

[英]CSS 3 scrollbar - add padding and cursor?

How can I add these two things on the scrollbar? 如何在滚动条上添加这两件事?

  1. padding around the scrollbar 滚动条周围的填充
  2. a cursor when you hover the scrollbar 悬停滚动条时的光标

This is my code: 这是我的代码:

    #style-4::-webkit-scrollbar-track
    {
        background-color: #fff;
    }

    #style-4::-webkit-scrollbar
    {
        width: 5px;
        background-color: #fff;

    }

    #style-4::-webkit-scrollbar-thumb
    {
        background-color: #ccc;

    }

    #style-4::-webkit-scrollbar-thumb:hover
    {
        background-color: #666;
        cursor: pointer;
    }

You can see it here . 你可以在这里看到它。 I want to add the padding like the ones on cssdeck. 我想像在cssdeck上那样添加填充。

Is it possible? 可能吗?

About that padding. 关于那个填充。 Sample 5px padding from left 从左侧采样5像素填充

#style-4::-webkit-scrollbar {
    width: 10px; /* add 5px */
    ...
}

#style-4::-webkit-scrollbar-thumb {
    box-shadow: inset 5px 0 0 0 white; /* change color to your bg color */
    ...
}

Adding cursor: pointer to every -webkit-scrollbar element does not unfortunately work. 不幸的是,添加cursor: pointer每个-webkit-scrollbar元素的cursor: pointer无法正常工作。

Yes You can add it. 是的,您可以添加它。

    #style-4:hover{
  padding:15px;
}

I think this is correct, if im wrong please let know what you expect. 我认为这是正确的,如果我错了,请告诉您您的期望。

Try this one for Cursor 试试这个游标

#style-4:hover{
  cursor:pointer;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM