<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>dia 25</title>
<link rel="stylesheet" href="style.css" type="text/css" media="all">
</head>
<body>
<div class="container">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
body{
margin: 0;
padding: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #0B1734
}
.container {
width: 100px;
height: 100px;
position: relative;
animation: animate 1s linear infinite;
transform: rotate(45deg);
}
span {
position: absolute;
width: 50px;
height: 50px;
animation: rotate 1s linear infinite
}
span:nth-child(1) {
top: 0;
left: 0;
background-color: #FCEBA7;
}
span:nth-child(2) {
top: 0;
right: 0;
background-color: #55DDB9;
}
span:nth-child(3) {
bottom: 0;
left: 0;
background-color: #FD6C64;
}
span:nth-child(4) {
bottom: 0;
right: 0;
background-color: #1F78B0;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
10% {
transform: rotate(0deg);
}
50% {
transform: rotate(90deg);
}
90% {
transform: rotate(90deg);
}
100% {
transform: rotate(90deg);
}
}
@keyframes animate {
0% {
width: 100px;
height: 100px;
}
10% {
width: 100px;
height: 100px;
}
50% {
width: 150px;
height: 150px;
}
90% {
width: 100px;
height: 100px;
}
100% {
width: 100px;
height: 100px;
}
}
预览
控制台