[TOC]
>[success] # css手写进度条
样式如下:
![](https://img.kancloud.cn/15/3f/153f0b1df785fe7c6ce7530b7f29f346_526x37.png)
1. index.html
~~~
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>手写进度条</title>
<style>
.progress-outer {
width: 100%;
height: 30px;
background-color: #ebeef5;
border-radius: 25px;
position: relative;
}
.progress-outer .progress-inner {
position: absolute;
width: 60%; /* 只需要把这个宽度动态即可 */
height: 100%;
left: 0;
top: 0;
background-color: #409eff;
border-radius: 25px;
transition: width .6s ease;
text-align: right;
line-height: 30px;
}
.progress-outer .progress-inner .progress-_innerText {
margin-right: 10px;
color: white;
}
</style>
</head>
<body>
<!-- 最外层容器宽度 -->
<div style="width: 500px;">
<!-- 进度条外层 -->
<div class="progress-outer">
<!-- 进度条内层 -->
<div class="progress-inner">
<!-- 进度条文本 -->
<span class="progress-_innerText">60%</span>
</div>
</div>
</div>
</body>
</html>
~~~