Streaming live at 10am (PST)

Background video size


#1

Hi all,

I am trying to use a background video for a thumbnail.

I have uploaded it the same size as the image next to it.
But it seems to display some sort of random size? :confused:

I really want it to display the correct size.
I’ve seen a few posts on here using custom code to fix this issue.
Is there a way to do this in webflow?

Any ideas?

Share link: https://preview.webflow.com/preview/website-4bb32c-4d3e757d57ce8edf9b7eda56?preview=44da2aea1d35b5152d2fa70d758fb3e3


Here is my site Read-Only: LINK
(how to share your site Read-Only link)


#2

First, this is not a specific issue ofbackground-video (See “empty div example” below)

Why? You combine real images with bg-images/videos/color==== The div is empty!! & the height of the element set bypadding/min/max-height/height) – for example:

And this is whats happen when i remove the height property (The video “disappear”):

Solution:

Try this trick (No custom code - but this is not dynamic (If in the future you change the sizes of the “real” images you should also change thepadding-top %)

Why padding-top: 76.3%;?

Images size: 908 (width) / 1190 (height) X 100 = 76.3%

Empty div example:

Same idea with regular div with red background (To demonstrate this is not video issue)

Read more here:


#3

this looks excellent :slight_smile: going to try it now

thanks once again


#4

Why padding-top: 76.3%; ?

Images size: 908 (width) X 1190 (height) X 100 = 76.3%

^ is that right? I can’t seem to get 76.3% :thinking:


#5

sorry. Divide.
(908 / 1190) = 0.76302


#6

ahh yes! thanks, that was driving me nuts :slight_smile:


#7

any idea why the video seems to be chopping off the top?

in this case, his head


#8

No background-size: cover; for videos. The background-idea is more for a sky, clouds and so on (Not for content like faces -or- text). Maybe also this % trick wont work well with webflow styles.

Solution (maybe)

Webflow adds the video element (by js) - and add styles - so you must use custom code:

With inspect element this solve this issue (copy-paste before head)

<style>
   .w-background-video > video {
       width: 100%;
   }
</style>

before

After


#9

Thank you again loads. I’ll try this trick and let you know if it works :slight_smile:


#10

So the custom code works :slight_smile:
But only when I publish it. It doesn’t work when I look in preview?

Is this normal?


#11

Great ! :slight_smile: Yes. Custom CSS “works” only on live url (Like JS).


#12

Ahhh I didn’t know this. Thanks again!


#13

Hey again! I’m having trouble putting a background video on one of my pages.

Starting to think it might be that custom code interfering?

Basically it doesn’t seem to display.

If you could help again would be much appreciated!

Its on the SoftBank case study.

Share link - https://preview.webflow.com/preview/website-4bb32c-4d3e757d57ce8edf9b7eda56?preview=44da2aea1d35b5152d2fa70d758fb3e3


#15

@ryan585 i dont see any video under this page. Write me in private - this Q not related to all users. Thanks