본문 바로가기
개발/UI

버튼 디자인-2 (button Design-2 with CSS)

by kxxxgs 2023. 4. 27.
728x90

버튼 디자인 2

 

좋아요 버튼 등으로 활용할 수 있는 버튼이다.

 

 

 

 

✔️ HTML

<button class="like">
    <span class="material-icons-outlined before">favorite_border</span>
    <span class="material-icons-outlined after">favorite</span>
    <span class="text">Like</span>
</button>

 

✔️ CSS

.like {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #fc8989;
    border-radius: 35px;
    border: 0px;
    font-size: 25px;
    margin: 0 auto;
    color: #fff;
    cursor: pointer;
    transition: all .5s;
}
.like:hover {
    background-color: #ff6e6e;
}
.like:hover .before {
    opacity: 0;
}
.like .after {
    position: absolute;
    opacity: 0;
    color: #fff;
}
.like:hover .after {
    opacity: 1;
    animation: beat 1s infinite;
}
@keyframes beat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.15);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

 

✔️ GitHub

https://github.com/rudtn082/UI/tree/main/button2

반응형

댓글