input[type = range]

来源:互联网 发布:九零后网络郑州网站 编辑:程序博客网 时间:2024/06/07 02:06

range是H5的新属性,常用编写进度条。

//HTML<input type="range" />//CSS/*1、去掉默认样式*/input[type=range] {    -webkit-appearance: none;    width: 400px;    /*border-radius: 10px;*/ /*这个属性设置使填充进度条时的图形为圆角*/}input[type=range]::-webkit-slider-thumb {    -webkit-appearance: none;}    /*2、添加track滑动样式*/input[type=range]::-webkit-slider-runnable-track {    height: 10px;    background: #ccc;    border-radius: 10px; /*将轨道设为圆角的*/     /*轨道内置阴影效果*/    /*box-shadow: 0 1px 1px #def3f8, inset 0 .125em .125em #0d1112;*/}input[type=range]:focus {    outline: none;}/* 3、给thumb滑块添加样式 */input[type=range]::-webkit-slider-thumb {    -webkit-appearance: none;    height: 20px;    width: 20px;    margin-top: -5px; /*使滑块超出轨道部分的偏移量相等*/    background: #108ee9;     border-radius: 50%; /*外观设置为圆形*/    border: solid 1px rgba(205, 224, 230, 0.5); /*设置边框*/    box-shadow: 2px #fff; /*添加底部阴影*/}