How-to · · 1 min read

How to add a cinematic background loop to a hero

Pick a calm loop, add it as a muted, looping, inline video behind the hero with a poster image, lay a gradient over it so the headline stays readable, and hide the video for visitors who prefer reduced motion.

By the AnimatedWebs team

Steps

  1. 1

    Pick a loop

    Choose a calm clip that matches the mood of the brand. The Cinematic Backgrounds library has seamless loops you can preview.

  2. 2

    Add the video element

    Place a video element behind the hero content with autoplay, muted, loop and playsinline, plus a poster image.

  3. 3

    Add an overlay

    Put a gradient layer between the video and the text, dark for light text or light for dark text.

  4. 4

    Add the reduced-motion fallback

    Use the prefers-reduced-motion media query to hide the video and show the poster image instead.

  5. 5

    Test on a phone

    Open the page on a phone with a normal connection. The poster should show at once and the video should start without a tap.

The code

HTML
<section class="hero">
  <video class="hero-video" autoplay muted loop playsinline preload="metadata" poster="/loop-poster.jpg">
    <source src="/loop.mp4" type="video/mp4">
  </video>
  <div class="hero-shade"></div>
  <h1>Your headline</h1>
</section>
CSS
.hero { position: relative; min-height: 100svh; overflow: hidden; }
.hero-video, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-shade { background: linear-gradient(to top, rgb(0 0 0 / .7), rgb(0 0 0 / .1)); }
.hero h1 { position: relative; }
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
  .hero { background: url(/loop-poster.jpg) center / cover; }
}

With an AI builder

Tell your builder which file to use and paste the requirements: muted, looping, inline, poster image, gradient overlay and a reduced-motion fallback. Those five words prevent most problems.

Questions people ask

Why does my video not autoplay on iPhone?+

It needs both muted and playsinline. Without them the browser waits for a tap.

Will a video background slow my page?+

It adds weight, so keep the clip short and compressed, use a poster image, and set preload to metadata.

Can I use the watermarked preview on my site?+

No. Previews are watermarked. Pro members can copy or download the clean file from the library.

Sources

Related templates

See the technique running

Play the live demos, open the one you like, and start with a free template or unlock the whole library.