<video>
tag inside Webflow's Embed component.object-fit: cover
, z-index: -1
) and set the parent container to relative with defined height and overflow hidden for layout control.To add a background video in Webflow using custom code, you’ll need to use an HTML5 <video>
element embedded via the Embed component or Page Settings.
In the Designer, drag an Embed component (from Add panel > Components > Embed) into your layout where the background should appear.
Paste the following HTML code into the Embed panel:
<video autoplay muted loop playsinline preload="auto" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1;">
<source src="https://YOUR_VIDEO_LINK.mp4" type="video/mp4">
</video>
Replace https://YOUR_VIDEO_LINK.mp4 with the direct URL to your hosted video file.
Make sure styles like object-fit: cover
and z-index: -1
are set so the video stays behind other content.
To add a background video with custom code in Webflow, use the Embed component with an HTML <video>
tag, ensure proper CSS positioning, and host your video file externally. Make sure it is muted, set to autoplay, and uses compatible formats like MP4.