반응형
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
background: blueviolet;
margin: 10px;
animation: move 2s linear infinite alternate;
display: flex;
justify-content: center;
align-items: center;
}
.box::before {
content: "running";
font-size: 25px;
color: white;
font-weight: 800;
}
.box:hover {
animation-play-state: paused;
background: dodgerblue;
}
.box:hover::before {
content: "paused";
}
@keyframes move {
0% {
width: 100px;
}
100% {
width: 500px;
}
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
animation-play-state:
run : 작동
paused: 정지
반응형
'2020 > CSS' 카테고리의 다른 글
flex (0) | 2020.03.24 |
---|---|
css 다단 (0) | 2020.03.24 |
animation-fill-mode (0) | 2020.03.24 |
animation-iteration-count, animation-direction (0) | 2020.03.24 |
animation-timing-function (0) | 2020.03.24 |