效果:
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="icon" href="./image/Logo.png" />
<title>跳动小球</title>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<div class="text">
<b>跳动小球</b>
</div>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<!-- 二维码 -->
<div class="image">
<img alt="image" src="./image/ma.png" >
</div>
</body>
</html>
css:
body {
margin: 0;
padding: 0;
background: #FFEB3B;
}
ul{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
margin: 0;
padding: 0;
display: flex;
}
ul li{
list-style: none;
width: 50px;
height: 50px;
background: #cea321;
margin: 0 5px;
border-radius: 50%;
animation: animate 1.4s linear infinite;
}
@keyframes animate {
0%
{
transform: translateY(0);
}
60%
{
transform: translateY(0);
}
80%
{
transform: translateY(-20px);
}
100%
{
transform: translateY(0px);
}
}
ul li:nth-child(1){
animation-delay: 0;
}
ul li:nth-child(2){
animation-delay: -1.2s;
}
ul li:nth-child(3){
animation-delay: -1s;
}
ul li:nth-child(4){
animation-delay: -.8s;
}
ul li:nth-child(5){
animation-delay: -.6s
}
ul li:nth-child(6){
animation-delay: -.4s;
}
ul li:nth-child(7){
animation-delay: -.2s;
}
.image{
width: 200px;
height: 200px;
position: absolute;
top: 80%;
left: 50%;
transform: translate(-50%,-50%);
margin: 0;
padding: 0;
display: flex;
}
.text{
/* width: 200px;
height: 200px; */
position: absolute;
top: 10%;
left: 40%;
text-align: center;
font-size: 50px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: black;
}