html+css:电池电量百分⽐效果图效果图:
代码
<!DOCTYPE html>borderbox
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.container {
height: 200px;
width: 120px;
position: relative;
border: 1px solid pink;
box-sizing: content-box;
border-top: none;
}
.box {
background-color: pink;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.rela {
position: relative;
width: 100%;
height: 100%;
}
.leftCon {
width: 41px;
height: 19px;
position: absolute;
left: -1px;
top: 0;
background-color: white;
border-right: 1px solid pink;
border-bottom: 1px solid pink;
border-left: 1px solid white;
border-top: 1px solid white;
}
.rightCon {
border-right: 1px solid white;
border-top: 1px solid white;
width: 41px;
height: 19px;
position: absolute;
right: -1px;
top: 0;
background-color: white;
border-left: 1px solid pink;
border-bottom: 1px solid pink;
border-right: 1px solid white;
border-top: 1px solid white;
}
.line {
width: 40px;
height: 1px;
background-color: pink;
position: absolute;
top: 0;
left: 40px;
}
</style>
// 引⼊jquery
<script src="jquery-3.4.1.min.js"></script> </head>
<body>
<div >
<span>
请输⼊电池电量百分⽐:0-100范围
</span> <input class="inputVal" value="" />  </div>
<div class="container">
<div class="box">
</div>
<div class="rela">
</div>
<div class="leftCon">
</div>
<div class="rightCon">
</div>
</div>
</div>
<script>
$('.inputVal').change(function() {
$('.box').css({
height: $('.inputVal').val() * 2 + 'px'    })
})
</script>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。