How to add a video background to a hero section in Webflow
Updated
In Webflow, add a Background Video element to your hero section, upload a file under 30 MB, and place your heading inside it. If you need a poster image, a transparent video or your own formats, use a Code Embed with a standard <video> tag instead.
A seamless 3D hero loop: the kind of video this guide is about
Option 1: the Background Video element
- 1Select your hero section, then press
Cmd/Ctrl + E(Quick find) and type Background video, or drag it in from Add panel → Components. - 2Upload your video when Webflow asks. It accepts webm, mp4, mov and ogg, and transcodes every upload to mp4 and webm for you.
- 3Drag your heading, text and buttons inside the Background Video element so it works as the section itself, and set its height (for example
90vh). - 4In the element settings, keep Loop video and Autoplay video on. Decide whether to keep the play/pause button (see the reduced-motion note below).
- 5Add a colour or gradient overlay in the element's background styles if your text needs more contrast, then publish and test on a phone.
Limits to know
- Files must be under 30 MB, and filenames can't contain spaces or special characters (dashes are fine).
- Visitors with Prefers reduced motion turned on won't see it play. If you remove the play/pause button, they can't start it at all.
- Webflow warns it may not autoplay on touch devices in data saver or low power mode.
- Webflow's docs don't describe a poster or fallback image setting, and because uploads are transcoded, transparent (alpha) video isn't something to rely on here.
Option 2: a Code Embed with your own video tag
A Code Embed lets you choose the exact files, add a poster, and handle reduced motion yourself. It accepts HTML, <style> and <script> up to 50,000 characters, and custom code needs a paid Workspace (Core, Growth, Agency or Freelancer) or an active Site plan.
- 1Host your video files and poster at public HTTPS URLs (a CDN or storage bucket works well).
- 2In your hero section, open Add panel → Custom Code → Code Embed and paste the snippet below, replacing the file paths.
- 3Scripts show as a placeholder in the Designer. Check the result in preview or on the published site.
<section class="hero">
<video class="hero__video" autoplay muted loop playsinline
preload="metadata" poster="/hero-poster.webp" aria-hidden="true">
<source src="/hero-loop.av1.webm" type='video/webm; codecs="av01.0.08M.10"'>
<source src="/hero-loop.mp4" type="video/mp4">
</video>
<div class="hero__content">
<h1>Your headline</h1>
</div>
</section>
<style>
.hero { position: relative; isolation: isolate; min-height: 90vh; overflow: hidden; }
.hero__video { position: absolute; inset: 0; z-index: -1;
width: 100%; height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) {
.hero__video { display: none; }
.hero { background: url(/hero-poster.webp) center / cover; }
}
</style>Code that should load on every page (like a player script) can go in Site settings → Custom code → Head or Footer instead of each embed.
Things that trip people up
- Heavy videos are the usual reason a hero feels slow. Aim for a few megabytes, not the 30 MB ceiling.
- Autoplay in the Designer isn't a reliable test. Judge it on the published site.
- Keep the text readable in the first frame, because some phones in low power mode will show only that.
The one-line version
Edgeloop loops ship with a small player that does all of the above for you: the right format per browser, a poster while it loads, pausing off-screen, reduced-motion support and a transparent version for your own background.
<script src="https://edgeloop.studio/hero-loop.js" defer></script>
<hero-loop src="/loops/your-loop/" focus="right center"></hero-loop>Collection 01 opens soon. Join the waitlist for 3 free loops.
Questions
What's the maximum background video size in Webflow?
Under 30 MB, in webm, mp4, mov or ogg. Webflow transcodes the upload to mp4 and webm.
Why doesn't my Webflow background video play for some visitors?
It doesn't play for people who have reduced motion turned on, and it may not autoplay on touch devices in data saver or low power mode.
Can I use a transparent video in Webflow?
Not reliably through the Background Video element, because uploads are transcoded. Use a Code Embed with a VP9-alpha WebM for Chrome, Edge and Firefox and an HEVC-alpha file for Safari.