본문 바로가기
Web/HTML | CSS|JAVASCRIPT

hover, keyframes를 이용한 버튼(HTML, CSS)

by 싸공 2020. 7. 15.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    body{
        margin0;
        padding0;
        background#000;

    }
    .container {
        width100%;
        height : 100vh;
        display:flex;
        align-itemscenter;
        justify-contentcenter;
    }
    button{
        positionrelative;
        cursorpointer;
        bordernone;
        width500px;
        height200px;
        border-radius60px;
        backgroundlinear-gradient(90deg#ff00d9#ff0000#fda502#ff00d9);
        background-size300%;
        color:#fff;
        font-size50px;
        letter-spacing4px;
    }
    button::before{
        content'';
        positionabsolute;
        top:0;
        left : 0;
        right : 0;
        bottom0;
        z-index-1;
        backgroundlinear-gradient(90deg#ff00d9#ff0000#fda502#ff00d9);
        background-size300%;
        border-radius60px;
        opacity0;
        transition0.4s;
    }
    button:hover{
        animation: animate 5s linear infinite;
    }
    button:hover::before{
        filterblur(20px);
        opacity0.7;
        animation: animate 5s linear infinite;
    }
    @keyframes animate {
        0%{
            background-position0%;
        }
        100%{
            background-position300%;
        }
        
    }

</style>
<body>
    <div class="container">
        <button>helloworld</button>
    </div>
</body>
</html>