Ayushman

Jena

Responsive

valentines-day-card-using-html-and-css

Table of Contents

Part 1 HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Valentine's Day Flip Book</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

  <div id="hedlinecontainer">
    <div id="shine">Happy Valentine's Day💞</div>
  </div>
  

  <div class="gallery">
    <img src="images/selfie-kiss-pair-man-preview 1.png" alt="a lovely kiss in the night">
    <img src="https://picsum.photos/id/1013/400/400" alt="a women inside a car">
    <img src="images/girl-and-boy-romantic-love-7hhjaln7dc787mco 1.png" alt="a baby">
    <img src="images/couple-girl-boy-love-preview 1.png" alt="a girl in the forest">
    <img src="images/photo-1547685325-cd2a90745574 1.png" alt="a girl">
  </div>

</body>
</html>

Part 2 CSS

.gallery {
  --d: 10s;
  /* duration */
  display: grid;
  place-items: center; /* Center both horizontally and vertically */
  width: 220px;
  margin-left: 220px;
}

.gallery > img {
  grid-area: 1/1;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 10px solid #f2f2f2;
  box-shadow: 0 0 4px #0007;
  z-index: 2;
  animation: slide var(--d) infinite, z-order var(--d) infinite steps(1);
}

.gallery img:last-child {
  animation-name: slide, z-order-last;
}

.gallery > img:nth-child(1) {
  animation-delay: calc(0*var(--d));
  --r: 16deg;
}

.gallery > img:nth-child(2) {
  animation-delay: calc(-0.2*var(--d));
  --r: -1deg;
}

.gallery > img:nth-child(3) {
  animation-delay: calc(-0.4*var(--d));
  --r: -19deg;
}

.gallery > img:nth-child(4) {
  animation-delay: calc(-0.6*var(--d));
  --r: 6deg;
}

.gallery > img:nth-child(5) {
  animation-delay: calc(-0.8*var(--d));
  --r: -8deg;
}

@keyframes slide {
  10% {
    transform: translateX(120%) rotate(var(--r));
  }
  0%, 100%, 20% {
    transform: translateX(0%) rotate(var(--r));
  }
}

@keyframes z-order {
  10%, 20% {
    z-index: 1;
  }
  80% {
    z-index: 2;
  }
}

@keyframes z-order-last {
  10%, 20% {
    z-index: 1;
  }
  90% {
    z-index: 2;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-content: center;
  background: #f8f6f1;
  overflow: hidden;
}

#hedlinecontainer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  margin-bottom: 60px;
}

#shine {
  font-size: 60px;
  font-weight: bold;
  color: rgba(255, 0, 102, 0.3);
  z-index: 10;
  background: -webkit-gradient(linear, left top, right top, from(#222), to(#222), color-stop(0.5, #fff)) 0 0 no-repeat;
  -webkit-background-size: 150px;
  -webkit-background-clip: text;
  -webkit-animation-name: shine;
  -webkit-animation-duration: 3s; /* Adjust the duration as needed */
  -webkit-animation-iteration-count: infinite;
  text-shadow: 0 0px 0px rgba(233, 85, 189, 0.419);

}

@-webkit-keyframes shine {
  0%, 10% {
    background-position: -1000px;
  }
  20% {
    background-position: top left;
  }
  90% {
    background-position: top right;
  }
  100% {
    background-position: 1000px;
  }
}

@media only screen and (max-width: 600px) {
  #shine {
  font-size: 22px;
}
#hedlinecontainer {
  display: flex;
  justify-content: center;
  align-items: center;

  margin-bottom: 60px;
}

.gallery {
  --d: 10s;
  /* duration */
  display: grid;
  place-items: center; /* Center both horizontally and vertically */
  width: 150px;
  margin-left: 60px;
}
}

Speed Up Website

Reach Google Page Speed Score 90+