效果展示
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<section><span></span></section>
</body>
</html>
CSS
html,body{
margin: 0;
height: 100%;
}
body{
display: flex;
justify-content: center;
align-items: center;
background: #263238;
}
section {
width: 650px;
height: 300px;
padding: 10px;
position: relative;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid red;
}
span {
width : 96px;
height: 96px;
background: white;
border-radius: 50%;
animation: animloader 1s ease-in infinite;
}
@keyframes animloader {
0% { transform: scale(0); opacity: 1;}
100% { transform: scale(1); opacity: 0;}
}
使用span标签,设置
width : 96px;
height: 96px;
background: white;
效果图如下
span圆角化
border-radius: 50%;
效果图如下
为span设置动画
animation: animloader 1s ease-in infinite;
@keyframes animloader {
0% { transform: scale(0); opacity: 1;}
100% { transform: scale(1); opacity: 0;}
}
效果图如下