HTML如何做出这种效果的进度条

要求输入后面的值之后,进度条可以自己对应比例的显示

我这个做法用的jQuery

span{display:inline-block;*display:inline-block;zoom:1;}
.bg{width:300px;height:20px;border-radius:10px;background:#3D3C3A;}
.main{height:20px;border-radius:10px;background:#55404C;}

<span class="bg">
    <span class="main"></span>
</span>
<span class="num">70%</span>

$(function(){
    var _width = $('.num').text();//获取百分比数值
    $('.main').css('width',_width);//将数值赋值给main的width
});

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-02-11
td 设置一个背景图片
然后 td 放一个 img ,然后用 js改变img 的 width 。
第2个回答  2015-02-11
html5中有这个标签 <meter>
第3个回答  2015-02-11
留爪我也不会。同求。
第4个回答  2017-09-29
<style type="text/css">
span{
display:inline-block;
*display:inline-block;
zoom:1;
}
.bg{
width:300px;
height:20px;
border-radius:10px;
background:#3D3C3A;
}
.main{
/* width:70%; */
height:20px;
border-radius:10px;
background:#55404C;
}</style>
==============================================
<script>
function assign(){
var _width = document.getElementById("percent").innerText;
alert(_width);
document.getElementById("changed").style.width = _width;
}
</script>
==========================================
<BODY>
<span class="bg">
<span class="main" id="changed"></span>
</span>
<span class="num" id="percent">70%</span>
<input type="button" value="赋值" onclick="assign()">
</body>