Sizing a background video

I’ve seen a lot of questions but couldn’t find a solution. It seems like many issues are related to mobile, but not me. All I want is to show a video on desktop, in a loop, but not on full screen.
I’ve inserted a background video into a div, but no matter what position I picked (static, relative, absolute) it goes beyond the borders of the div. I can use overflow:none, but that would crop a significant part of my video. What should I do?


Thats because you have the hight on the video set to 500px and the width of the div to 500px so of course it will go outside of the parameters. Background videos don’t work the same as background images. Size your video manually based on it’s aspect ratio. Do you want this to be a popup type thing or just a certain size on the page? If the latter, just nest it inside a section then container and it should span 960px wide automatically.

If you are new to Webflow and web design in general, I suggest checking out a whole lot of the videos on the university page before continuing. It will save you tons of frustration.

1 Like

Hey, @LupoAsaf,

Background video is not the proper choice for what you’re trying to accomplish. By its very nature, it is intended to provide context by supporting the adjacent or overlaid content. Likewise, background video will always “cover” the available space as opposed to "contain"ing the video in the available space. If you were using an image, you’d have the choice between the two.

However, I think what you’re looking for is a scalable video component. There are two which are labeled as video or youtube in the components panel. Just set the video “100%” width and height to “auto” and it will stay proportionate to its container…however…

It also appears you’re trying to show a non-hosted video (i.e. not Youtube, Vimeo, etc). That, unfortunately, eliminates the two video components mentioned. There is no current, built-in, component that allows you to upload your own video (like background video does) but treats it like a traditional video.

Is there a reason you’re not using youtube nor vimeo to serve up this video?

1 Like

Thank you for the quick reply. I don’t mind hosting the video at all, but I’d like the video to auto-play and loop (like a GIF but without the limitation of length or quality). It seems like the background video is a better fit.
I’ve tried to implement @DFink’s advice, but the video bleeds in both axis. That doesn’t make sense to me even in a cover context. Don’t you think, @flowpros?

1 Like

If anyone runs into this problem, I got a solution from Micah at Webflow Support.
Here it is:
I was able to create a clone of your project, and used your background video file (we suggest you host your file externally, as it would be easier to locate and manage) to create a custom coded video player that automatically plays:

You may access the Read-Only link at the following URL:

The following short screencapture notes the process to implement this video player: Screen Recording 2019-02-28...

In case the video is no longer available, the idea is to use HTML element instead of a video background element with the following code:

<video playsinline autoplay muted loop width="100%">
  <source src=" Capsule Seth-transcode.mp4" type="video/mp4">

Make sure to replace the link to the video in the code above (next to “src=”).
Good luck, and thanks Micha!


This is great and works if your code example is pasted into my website HTML code with DIv block as it seems you file is hosted on Webflow which I can’t do… However, I cannot seem to get it to work with hosting on Youtube or Vimeo. Any ideas why?

Very frustrating basics. Functionality should have been thought about and built into Webflow when the background was implemented.

1 Like

I am in the same situation. I cannot think of any situation where a professional project would include video posted on youtube. The branding, the recommended videos. The tow video components only force designers to purchase Wista or other pricy video hosting solutions.


Magic, thanks…(post must be blah blah blah characters)

Unbelievable that video functionality of this kind is not supported. Might as well use a platform that is 10 times easier to use.


You are my lifesaver. Thank you!!!

this code is a huge life saver! can you help me figure out where to find my video code?

So a responsive contained autoplay video element is not doable unless i upgrade and use custom code is this still the case?
It seems like webflow didn´t even think of this. That does not make want to upgrade slash trust in learning the platform.
I better wait and see how many things like this i come across.

1 Like

Hey @jhiggins, how did you upload an mp4 to your Webflow assets?

1 Like

Hey @dankanvis - You can upload a background video, then grab the URL to the asset after it is rendered. You can then use it in custom code.

@webdev Awesome, that’s works perfectly. Thank you!

This is great, thank you!

@flowpros I found adding this inside <head> tag as custom code does the trick of 'contain’ing for background videos:

  video {
    object-fit: contain !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;