码迷,mamicode.com
首页 > 其他好文 > 详细

自定义滚动条demo

时间:2015-06-04 00:44:03      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

<html>
<head>
    <title></title>
    <style type="text/css">
        .test {
            width: 500px;
            height: 300px;
            border:1px solid #ededed;
            overflow: scroll;
        }
::-webkit-scrollbar/*整体部分*/
{
width: 10px;
height: 0
}

::-webkit-scrollbar-track/*滑动轨道*/
{
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
border-radius: 0px;
background: #fff;
}

::-webkit-scrollbar-thumb/*滑块*/
{
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: #c3c3c3;
}

::-webkit-scrollbar-thumb:hover/*滑块效果*/
{
/*border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);*/
}
    </style>
</head>
<body>
    <div class="test">
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>你好</p>
        <p>
                    /* Let‘s get this party started */
        ::-webkit-scrollbar {
            width: 12px;
        }
         
        /* Track */
        ::-webkit-scrollbar-track {
            -webkit-box-shadow: inset 0 0 5px #f6f6f6; 
            /*-webkit-border-radius: 10px;*/
            border-radius: 10px;
        }
        ::-webkit-scrollbar-track-piece {

        }
         
        /* Handle */
        ::-webkit-scrollbar-thumb {
            -webkit-border-radius: 10px;
            border-radius: 10px;
            background: #c3c3c3; 
            /*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); */
        }
        </p>    
    </div>
</body>
</html>

 

自定义滚动条demo

标签:

原文地址:http://www.cnblogs.com/chenqiushi/p/4550554.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!