1.html5 css3 怎么制作简单的进度条
HTML代码:
CSS代码:.progress { height: 20px; background: #ebebeb; border-left: 1px solid transparent; border-right: 1px solid transparent; border-radius: 10px; }.progress > span { position: relative; float: left; margin: 0 -1px; min-width: 30px; height: 18px; line-height: 16px; text-align: right; background: #cccccc; border: 1px solid; border-color: #bfbfbf #b3b3b3 #9e9e9e; border-radius: 10px; background-image: -webkit-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: -moz-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: -o-linear-gradient(top, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); background-image: linear-gradient(to bottom, #f0f0f0 0%, #dbdbdb 70%, #cccccc 100%); -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); }.progress > span > span { padding: 0 8px; font-size: 11px; font-weight: bold; color: #404040; color: rgba(0, 0, 0, 0.7); text-shadow: 0 1px rgba(255, 255, 255, 0.4); }.progress > span:before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 1; height: 18px; background: url("../img/progress.png") 0 0 repeat-x; border-radius: 10px; }.progress .green { background: #85c440; border-color: #78b337 #6ba031 #568128; background-image: -webkit-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: -moz-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: -o-linear-gradient(top, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); background-image: linear-gradient(to bottom, #b7dc8e 0%, #99ce5f 70%, #85c440 100%); }.progress .red { background: #db3a27; border-color: #c73321 #b12d1e #8e2418; background-image: -webkit-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: -moz-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: -o-linear-gradient(top, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); background-image: linear-gradient(to bottom, #ea8a7e 0%, #e15a4a 70%, #db3a27 100%); }.progress .orange { background: #f2b63c; border-color: #f0ad24 #eba310 #c5880d; background-image: -webkit-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: -moz-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: -o-linear-gradient(top, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); background-image: linear-gradient(to bottom, #f8da9c 0%, #f5c462 70%, #f2b63c 100%); }.progress .blue { background: #5aaadb; border-color: #459fd6 #3094d2 #277db2; background-image: -webkit-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: -moz-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: -o-linear-gradient(top, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); background-image: linear-gradient(to bottom, #aed5ed 0%, #7bbbe2 70%, #5aaadb 100%); }。
2.html 下图进度条怎么实现
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "1/DTD/xhtml1-transitional.dtd">
<html xmlns="">
<head>
<meta ; charset=utf-8" />
<title>jquery实现进度条</title>
<style>
.progressBar{width:200px;height:8px;border:1px solid #98AFB7;border-radius:5px;margin-top:10px;}
#bar{width:0px;height:8px;border-radius:5px;background:#5EC4EA;}
</style>
<script type="text/jscript" src="jquery.min.js"></script>
<script type="text/javascript">
function progressBar(){
//初始化js进度条
$("#bar").css("width","0px");
//进度条的速度,越小越快
var speed = 20;
bar = setInterval(function(){
nowWidth = parseInt($("#bar").width());
//宽度要不能大于进度条的总宽度
if(nowWidth<=200){
barWidth = (nowWidth + 1)+"px";
$("#bar").css("width",barWidth);
}else{
//进度条读满后,停止
clearInterval(bar);
}
},speed);
}
</script>
</head>
<body>
<input type="button" value="开始" onclick="progressBar()" />
<div class="progressBar"><div id="bar"></div></div>
</body>
</html>
3.如何用html5使用与实现一个进度条演示
<div>;显示度量值: <span id="value">0</span>%</div>
<meter id="meter" min="0" max="100" value="0"></meter>
<details>
<summary>;注释:</summary>
<p>IE 不支持 meter 标签</p>
<p>;进度条每0.5秒钟增加1%,直至到100%,然后再重复</p>
</details>
<script>
let meter = document.getElementById('meter');
let myValue = document.getElementById('value');
setInterval(function () {
if (meter.value == 100) {
meter.value = 0;
} else {
meter.value += 1;
}
myValue.innerHTML = meter.value;
}, 500)
</script>
转载请注明出处育才学习网 » html5进度条怎么写