HTML+CSS (上传中 /上传中) 动画
核心思想是使用两个伪元素组成按钮的水波纹,再使用动画无限循环
伪元素是一个圆,只有边框
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>上传中动画</title>
<style>
.box1{
width: 100px;
height: 100px;
display:flex;
align-items: center;
justify-content: center;
background-color: rgb(71, 153, 230);
border-radius: 50%;
margin:300px auto;
color: white;
}
.box1::before{
content: '';/*内容为空*/
display: block;/*转换成块元素*/
position: absolute;/*开启绝对定位定位*/
width: 100px;
height: 100px;
border-radius:50%;/*使方块变圆*/
border:solid 1px rgba(71, 153, 230,.2);
animation: loading 2s infinite;
}
.box1::after{
content: '';
display: block;
position: absolute;
width: 100px;
height: 100px;
border-radius:50%;
border:solid 1px rgba(71, 153, 230,.1);
animation: loading 2s infinite .7s;/*第二个圈圈延迟0.7秒后出现*/
}
@keyframes loading {
to{
transform: scale(1.4);/*放大1.4倍*/
}
}
</style>
</head>
<body>
<div class="box1">变丑中</div>
</body>
</html>
实现起来比较简单,试试吧!!!