보랑취향

[css애니메이션] 포인트버튼 (점점커지는버튼) 본문

IT/html&css

[css애니메이션] 포인트버튼 (점점커지는버튼)

보랑취향 2025. 6. 10. 13:53

 
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>플러스 버튼 + 퍼지는 효과</title>
 
<style>
  body {
    background: #fff;
    padding: 40px;
  }

  .plus {
    position: relative;
    width: 50px;
    height: 50px;
    display: inline-block;
    cursor: pointer;
  }

  /* 불투명한 앞 원 */
  .plus::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: #0cabc8;
    border-radius: 50%;
    z-index: 1;
  }

  /* 퍼지는 투명 원 효과 */
  .plus::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(12, 171, 200, 0.4);
    border-radius: 50%;
    transform: scale(0.7);
    opacity: 0.6;
    animation: ripple 1.5s infinite ease-out;
    z-index: 0;
  }

  @keyframes ripple {
    0% {
      transform: scale(0.7);
      opacity: 0.6;
    }
    100% {
      transform: scale(2.5);
      opacity: 0;
    }
  }

  /* + 아이콘 */
  .plus > span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    transform: translate(-50%, -50%);
    z-index: 2; /* 플러스가 위로 올라오게 */
  }

  .plus > span::before,
  .plus > span::after {
    content: "";
    position: absolute;
    background: #fff;
    border-radius: 1px;
  }

  .plus > span::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    transform: translateY(-50%);
  }

  .plus > span::after {
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    transform: translateX(-50%);
  }
</style>
 
</head>
<body>

<span class="plus"><span></span></span>

</body>
</html>
 
728x90

'IT > html&css' 카테고리의 다른 글

[css] 반응형  (0) 2025.06.13
[html 아이콘] 구글폰트 VS 폰트어썸5(Font Awesome 5 Brands)  (1) 2025.06.13
[스크립트] 년도 숫자 카운트 코딩  (0) 2025.06.09
css 용어정리  (1) 2025.04.09
<button>버튼테그</button>  (2) 2024.02.09
Comments