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

간단한 hover 기능 구현(HTML, CSS)

by 싸공 2020. 7. 27.
<!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>
<body>
    <span>button</span>
    <span>button</span>
</body>
<style>
    *{
        margin0;
        padding0;
        
    }
    body{
        displayflex;
        justify-contentcenter;
        align-itemscenter;
        min-height80vh;
        background#7373ac;
    }
    span{
        positionrelative;
        padding20px 30px;
        margin10px;
        background#ffffff;
        color#fff;
        text-decorationnone;
        border1px solid #000;
        transition0.5s;
    }
    span:hover{
        background#378d54;
    }
    span:nth-child(2):hover{
        background#070000;
    }
</style>
</html>