How to customize the HTML5 input range type looks using CSS?

后端 未结 10 2271
粉色の甜心
粉色の甜心 2020-11-27 15:24

I want to customize the looks of the range input type in HTML5 to look something like a progress bar. I\'ve tried applying some common CSS attributes using CSS class but it

10条回答
  •  余生分开走
    2020-11-27 15:59

    This is an example:

    input[type='range'] {
    	-webkit-appearance: none;
    	border-radius: 5px;
    	box-shadow: inset 0 0 5px #333;
    	background-color: #999;
    	height: 10px;
    	vertical-align: middle;
    }
    input[type='range']::-moz-range-track {
    	-moz-appearance: none;
    	border-radius: 5px;
    	box-shadow: inset 0 0 5px #333;
    	background-color: #999;
    	height: 10px;
    }
    input[type='range']::-webkit-slider-thumb {
    	-webkit-appearance: none !important;
    	border-radius: 20px;
    	background-color: #FFF;
    	box-shadow:inset 0 0 10px rgba(000,000,000,0.5);
    	border: 1px solid #999;
    	height: 20px;
    	width: 20px;
    }
    input[type='range']::-moz-range-thumb {
    	-moz-appearance: none;
    	border-radius: 20px;
    	background-color: #FFF;
    	box-shadow:inset 0 0 10px rgba(000,000,000,0.5);
    	border: 1px solid #999;
    	height: 20px;
    	width: 20px;
    }

提交回复
热议问题