CSS3 做一个有闪光效果的进度条

88 阅读1分钟
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>做一个进度条</title>
</head>
<body>
  <div class="prog">
    <div class="prog_line" style="width:50%"></div>
  </div>
</body>
</html>

.prog {
    width: 100%;height: 20px; border-radius: 5px; background: #f0f0f0;
    margin:20px auto;
}
.prog_line {
    transition: all 0.25s ease-in-out;
    height: 20px; background: #20A0FF;border-radius: 5px; position: relative;
}
.prog_line:after {
    display: block; content:"";height: 20px; background: #fff; border-radius: 5px;
    position: absolute; left: 0; top: 0;
    animation: progshow 1s infinite;
}
@keyframes progshow {
    0%   {width: 0; opacity: .3;}
    100% {width: 100%; opacity: 0.1;}
}