Hi

css @keyframes 본문

WEB(웹)/css

css @keyframes

SharingWorld 2018. 10. 27. 08:22

@keyframes

애니메이션 효과를 진행 속도나 단계를 직접 지정할 때 사용합니다.

<!DOCTYPE html>
<html>
<head>
    <title>13-02</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        .box {
            background-color: blue;
            width: 50px;
            height: 50px;
            position: absolute;
            top: 20px;
            left: 30px;
        }

        @keyframes shake-box {
            0% {
                transform: translateX(-20px);
                background-color: blue;
            }
            50% {
                transform: translateX(10px);
                background-color: yellow;
            }
            100% {
                transform: translateX(-20px);
                background-color: blue;
            }
        }

        .box:hover {
            animation: shake-box 0.2s infinite;
        }
    </style>
</head>
<body>
<div class="box"></div>
</body>
</html>


출처 : vue.js quickstart

'WEB(웹) > css' 카테고리의 다른 글

z-index 안될 때  (0) 2018.10.23
align-content  (0) 2018.08.19
background-clip  (0) 2018.07.15
animate.css  (0) 2018.07.06
css clearing  (2) 2018.07.06