赞
踩
废话不多说,我们直接上代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="cache-control" content="no-cache">
<meta name="browsermode" content="application">
<meta name="x5-page-mode" content="app">
<meta name="msapplication-tap-highlight" content="no">
<title>刻度尺效果</title>
<style>
*{
padding: 0;
margin: 0;
}
.scale{
position: relative;
width: 100%;
padding: 10px 0;
}
.scale em{
position: absolute;
top: 50%;
display: block;
width: 36px;
height: 28px;
font-size: 20px;
font-style: normal;
line-height: 28px;
margin-top: -14px;
}
.scale em.blue{
left: 10px;
color: #4359aa;
}
.scale em.red{
right: 10px;
color: #ff3300;
}
form{
padding: 0 60px;
}
input[type="range"]{
width: 100%;
height: 9px;
background: url(images/int-risk-level-bar.png) no-repeat center;
background-size: 100% 9px;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 2px 2px 3px 0 rgba(11,18,73,0.4);
box-shadow: 2px 2px 3px 0 rgba(11,18,73,0.4);
-webkit-appearance: none;
outline: none;
}
input[type="range"]::-webkit-slider-thumb {
width: 28px;
height: 28px;
background: #ffffff;
-webkit-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: 0 0 3px 2px rgba(73,53,11,0.2);
box-shadow: 0 0 3px 2px rgba(73,53,11,0.2);
-webkit-appearance: none;
cursor: default;
}
output{
position: absolute;
left: 50%;
bottom: -40px;
display: block;
height: 40px;
width: 40px;
font-size: 16px;
color: #222222;
text-align: center;
line-height: 40px;
background: yellow;
margin-left: -20px;
}
</style>
</head>
<body>
<div class="scale">
<em class="blue">0</em>
<form oninput="scaleShow.value=parseInt(scale.value)">
<input type="range" id="scale"/>
<output name="scaleShow" for="scale" ></output>
</form>
<em class="red">100</em>
</div>
</body>
</html>
实现效果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。