How to add a video background to a hero section in Shopify
Updated
It depends on your theme. In Horizon, set the Hero section's media type to Video and it plays muted on a loop. Dawn has no looping hero video (its Video section is click-to-play), so add a Custom Liquid section with your own video tag.
A seamless 3D hero loop: the kind of video this guide is about
Option 1: the Hero section (Horizon theme)
- 1Upload your video in Content → Files (MOV, MP4 or WEBM, up to 1 GB and 10 minutes).
- 2Open Online Store → Themes → Customize and select the Hero section.
- 3Set the media Type to Video and choose your file.
- 4Optional: turn on custom mobile media to use a separate, lighter video or image on phones.
- 5Save and check the storefront on a phone.
Limits to know
- Horizon renders the hero video with autoplay, loop and mute, and no poster image, so a brief blank or first-frame flash is possible while it loads.
- Dawn's Video section isn't a background: it's click-to-play with sound. Image banner has no video option.
- Shopify generates streaming and MP4 versions of uploads; transparent video isn't documented, so don't count on alpha surviving.
Option 2: a Custom Liquid section
Custom Liquid works in any Online Store 2.0 theme, including Dawn. It accepts HTML and Liquid up to 50 KB.
- 1Upload your video and poster in Content → Files and copy their URLs.
- 2In the theme editor, choose Add section → Custom Liquid and drag it to the top of the page.
- 3Paste the snippet below with your file URLs and save.
<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>In Liquid you can also use Shopify's video_tag filter, which adds playsinline, preload="metadata" and a poster for you. Looping turns off its streaming (HLS) source and uses MP4.
Things that trip people up
- The theme editor preview doesn't always autoplay like the live store does; check the published storefront.
- Keep the file small. Mobile shoppers see your hero first, so a heavy video costs sales.
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
Does Shopify Dawn support a background video in the banner?
No. Dawn's Video section is click-to-play and Image banner has no video option. Use a Custom Liquid section.
What video files can I upload to Shopify?
MOV, MP4 and WEBM, up to 1 GB, 10 minutes and 4K resolution.