CSS Hover 효과연습

6376 단어 hoverCSStransitionCSS

transition에 width와 height의 속도를 다르게 적용하는 방법

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        .parent {
            width: 500px;
            height: 200px;
            position: center;
        }

        .child {
            position: absolute;
            width: 25px;
            height: 25px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: black;
            transition: width 0.7s, height 0.6s;
            border-radius: 100%;
        }

        .child:hover {
            width: 80%;
            height: 80%;
            background-color: black;
            transition: width 0.8s, height 0.5s;
        }


    </style>

</head>
<body>
<div class="parent">
    <div class="child"></div>
</div>

</body>
</html>

좋은 웹페이지 즐겨찾기