JSFiddle - React, Tailwind, and code Playground

by Hugo Vale Pereira

HTML

<main>
  <section class="section parallax bg1">
    <h1>Cute Kitten</h1>
  </section>
  <section class="section static">
    <h1>Boring</h1>
  </section>
  <section class="section parallax bg2">
    <h1>Fluffy Kitten</h1>
  </section>
</main>

CSS

main {
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  perspective: 2px;
}

.section { 
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 0 0 5px #000;
}

.parallax::after {
  content: " ";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateZ(-2px) scale(1.5);
  background-size: 100%;
  z-index: -1;
}

.static {
  background: red;
}

.bg1::after {
  background-image: url('https://placekitten.com/g/900/700');
}

.bg2::after {
  background-image: url('https://placekitten.com/g/800/600');
}