Animated Grid Layout using HTML CSS and JavaScript | 4 Seasons Layout

Web Design

In this tutorial we will create an Animated Grid Layout using HTML CSS and JavaScript for an 4 Seasons Layout Web page

Img:

HTML:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="style.css" />
    <title>Anima Grid Layout</title>
  </head>
  <body>
    <section id="Seasons">
      <div id="Winter" class="season"></div>
      <div id="Spring" class="season"></div>
      <div id="Summer" class="season"></div>
      <div id="Fall" class="season"></div>
    </section>
    <section class="Months">
      <!-- Winter -->
      <div class="bg Winter">
        <h2 class="text-anime">December</h2>
        <p class="text-anime">1 - 31</p>
      </div>
      <div class="bg Winter">
        <h2 class="text-anime">January</h2>
        <p class="text-anime">1 - 31</p>
      </div>
      <div class="bg Winter">
        <h2 class="text-anime">February</h2>
        <p class="text-anime">1 - 28/29</p>
      </div>
      <!-- Spring -->
      <div class="bg Spring">
        <h2 class="text-anime">March</h2>
        <p class="text-anime">1 - 31</p>
      </div>
      <div class="bg Spring">
        <h2 class="text-anime">April</h2>
        <p class="text-anime">1 - 30</p>
      </div>
      <div class="bg Spring">
        <h2 class="text-anime">May</h2>
        <p class="text-anime">1 - 31</p>
      </div>

      <!-- Summer -->
      <div class="bg Summer">
        <h2 class="text-anime">June</h2>
        <p class="text-anime">1 - 30</p>
      </div>
      <div class="bg Summer">
        <h2 class="text-anime">July</h2>
        <p class="text-anime">1 - 31</p>
      </div>
      <div class="bg Summer">
        <h2 class="text-anime">August</h2>
        <p class="text-anime">1 - 31</p>
      </div>

      <!-- Fall -->

      <div class="bg Fall">
        <h2 class="text-anime">September</h2>
        <p class="text-anime">1 - 30</p>
      </div>
      <div class="bg Fall">
        <h2 class="text-anime">October</h2>
        <p class="text-anime">1 - 31</p>
      </div>
      <div class="bg Fall">
        <h2 class="text-anime">November</h2>
        <p class="text-anime">1 - 30</p>
      </div>
    </section>
    <script src="app.js"></script>
  </body>
</html>

CSS:

@import url("https://fonts.googleapis.com/css2?family=Balsamiq+Sans&display=swap");

*,
::before,
::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: #111;
  color: #fff;
  font-family: "Balsamiq Sans", cursive;
  position: relative;
}

h2 {
  font-size: 2.5rem;
  font-weight: 300;
  margin: 0.6rem;
}

p {
  font-size: 2rem;
}
.Months {
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px 10px;
  z-index: 1;
}

.Months > div:nth-child(1) {
  grid-column: 1/3;
}

.Months > div:nth-child(5) {
  grid-column: 2/4;
}

.Months > div:nth-child(7) {
  grid-column: 1/3;
}
.Months > div:nth-child(9) {
  grid-column: 4/5;
}
.Months > div:nth-child(12) {
  grid-column: 3/5;
}

.Months > div {
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: 0.5s ease-in;
}

.bg {
  filter: blur(8px);
}

.text-anime {
  animation: text_anime 1.5s ease;
  text-shadow: 1px 2px 3px #111;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 0.4rem;
}
@keyframes text_anime {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}
.Winter {
  background: url(/img/winter.jpg);
}
.Spring {
  background: url(/img/Spring.jpg);
}
.Summer {
  background: url(/img/summer.jpg);
}
.Fall {
  background: url(/img/fall.jpg);
}
/* Seasons */
#Seasons {
  position: absolute;
  width: 100%;
  height: 100vh;
  display: grid;
  gap: 15px 10px;
}
.season {
  height: 100%;
  background-color: red;
  z-index: 3;
  transition: 1s ease-in;
  /* Style Text */
  font-size: 6rem;
  letter-spacing: 5px;
  text-shadow: 1px 2px 3px #111;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

Check out My Courses for Beginner to advanced Web Developers !

Crash Courses:

HTML Crash Course:

CSS Crash Course:

SASS Crash Course:

Disclaimer! This is a video is inspired by: Traversy Media CSS Grid Layout With Image Span

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.