<!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="styles/main.css">
<title>CSS</title>
</head>
<body>
<div class="box">
a
</div>
</body>
</html>
.box{
width:100px;
height: 100px;
border: 10px solid seagreen;
background-color: rgb(204,253,225);
border-radius: 30px;
animation: my-first-animation 5s infinite;
}
@keyframes my-first-animation{
0%{
font-size: 20px;
}
50%{
width: 300px;
font-size: 50px;
}
100%{
width: 100px;
font-size: 10px;
}
}
keyframes을 사용 시 에는 2개 이상의 조건이 있어야 함.
<!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="styles/main.css">
<title>CSS</title>
</head>
<body>
<div class="box1">
a
</div>
<div class="box2">
a
</div>
<div class="box3">
a
</div>
</body>
</html>
div {
width:100px;
height: 100px;
border: 10px solid silver;
border-radius: 30px;
animation: my-first-animation 1s infinite;
}
.box1{
background-color: rgb(204,253,225);
/* 초기 값 */
animation-delay: 0;
}
.box2{
background-color: rgb(255,221,198);
animation-delay: 0.3s;
}
.box3{
background-color: rgb(186,239,250);
animation-delay: 0.6s;
}
@keyframes my-first-animation{
0%{
font-size: 20px;
}
50%{
width: 300px;
font-size: 50px;
}
100%{
width: 100px;
font-size: 10px;
}
}