Text in Responsive Background Image Overflow

.background-image-anime {
  width: 100%;
  background-size: 100% auto;
  background-image: url('../assets/ezgif-3-d2831f8743.gif');
}
.background-image-anime::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
}
.centered-div {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

<main class="background-image-anime h-screen"> <!-- h-screen is basically setting it to height: 100dvh -->
    <div class="centered-div">Lmao</div>
</main>

In this code, I want the text / div to not go beyond the image vertically when viewing it in mobile. Due to the Parent height, it overflows the image. How can I solve this problem? (On Desktop, it looks fine.)
image-8.png
image-7.png
Was this page helpful?