CSS입문
CSS_애니메이션_22.04.13(Thu)
양빵빵
2022. 4. 14. 11:20
animation-play-state
애니메이션의 재생과 정지를 설정
running : 애니메이션을 동작 (기본값)
paused : 애니메이션 동작을 정지
<!DOCTYPE html>
<html lang="ko">
<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">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
background: tomato;
text-align: center;
line-height: 100px;
animation: size-up 3s linear infinite alternate;
}
@keyframes size-up{
0% {
width: 100px;
}
100% {
width: 100%;
}
}
.box::before {
content : '재생중';
font-size: 24px;
font-weight: 700;
color: #fff;
}
.box:hover {
background: skyblue;
animation-play-state: paused;
}
.box:hover::before {
content : '중지!';
color: black;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>