JSFiddle - React, Tailwind, and code Playground

by Oliver

HTML

<div class="video-background">
  <iframe src="https://www.youtube.com/embed/biWk-QLWY7U?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&mute=1" frameborder="0" allowfullscreen></iframe>
</div>

SCSS

* {
  padding: 0;
  margin: 0;
}

.video-background {
  position: relative;
  overflow: hidden;
  width: 100vw;
  height: 100vh;

  iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);

    @media (min-aspect-ratio: 16/9) {
      height: 56.25vw
    }

    @media (max-aspect-ratio: 16/9) {
      width: 177.78vh
    }
  }
}