input[type="range"]是html5中的input标签新属性,样子如下:

CSS修改input[type=range]滑块样式

<input type="range" value="40" />

如果想让此滑块效果如下图所示,怎么做呢?

CSS修改input[type=range]滑块样式

以下是样式部分:

 

<style type="text/css">
            input[type="range"] 
{
                -webkit-box-shadow
: 0 1px 0 0px #424242, 0 1px 0 #060607 inset, 0px 2px 10px 0px black inset, 1px 0px 2px rgba(0, 0, 0, 0.4) inset, 0 0px 1px rgba(0, 0, 0, 0.6) inset;
                margin-top
: 2px;
                background-color
: #272728;
                border-radius
: 15px;
                width
: 400px;
                -webkit-appearance
: none;
                height
:10px;
            
}
            input[type="range"]::-webkit-slider-thumb 
{
                -webkit-appearance
: none;
                cursor
: default;
                top
: -5px;
                height
: 30px;
                width
: 20px;
                transform
: translateY(-4px);
                background
: none repeat scroll 0 0 #777;
                border-radius
: 15px;
                -webkit-box-shadow
: 0 -1px 1px black inset;
            
}
        </style>

 

相关文章:

  • 2022-01-08
  • 2021-11-30
  • 2021-07-19
  • 2022-01-08
  • 2021-12-04
  • 2021-12-30
  • 2021-11-13
  • 2021-11-13
猜你喜欢
  • 2021-09-11
  • 2021-10-27
  • 2021-11-03
  • 2021-09-20
  • 2022-01-08
  • 2021-12-14
  • 2021-11-13
  • 2021-09-20
相关资源
相似解决方案