비전공자 개발일기

Love Animation 본문

HTML _CSS

Love Animation

HiroDaegu 2022. 4. 29. 00:01
728x90
SMALL

 

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>LOVE Animation</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="love">
  <input type="checkbox" name="" id="">
  <span></span>
  <span></span>
  <span></span>
  <p></p>
</div>  
</body>
</html>
body {
  background-color: black;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.love {
  position: relative;
  width: 50px;
  height: 50px;
}

p::after {
  position: absolute;
  width: 50px;
  height: 50px;
  content: "I LOVE";
  font-size: 5px;
  font-weight: 700;
  top: 10px;
  left: 1px;
  transition: all .5s ease-in-out;
}

.love span {
  position: absolute;
  width: 30px;
  height: 30px;
  background-color: #00dd5f;
  transition: all .5s ease-in-out;
}

.love input {
  position: absolute;
  width: 50px;
  height: 50px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 9;
}

.love input:checked~span:nth-child(2) {
  background-color: #d40000;
  border-radius: 50%;
  left: 0;
  z-index: 1;
  animation: effects .5s linear alternate;
}

.love input:checked~span:nth-child(3) {
  background-color: #d40000;
  border-radius: 50%;
  left: 20px;
  z-index: 1;
  animation: effects .5s linear alternate;
}

.love input:checked~span:nth-child(4) {
  background-color: #d40000;
  top: 10px;
  left: 10px;
  transform: rotate(45deg);
  animation: effects .5s linear;
}

.love input:checked~p:after {
  content: "YOU";
  letter-spacing: 3px;
  color: #fff;
  z-index: 1;
  top: 15px;
  left: 13px;
}

@keyframes effects {
  100% {
    transform: rotate(360deg);
  }
}
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Neon Text Glow Animation  (0) 2022.05.01
Scanner Animation  (0) 2022.04.30
Profile Card  (0) 2022.04.28
Endless Road Animation  (0) 2022.04.26
Gradient Background Animation  (0) 2022.04.25