您的位置:首页 > Web前端 > HTML5

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

2017-12-14 17:33 615 查看
input[type="range"]是html5中的input标签新属性,样子如下:



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

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



以下是样式部分:

 

<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: