Jump to content

So I have a YouTube video in the progress of being rendered that I want to have as my website background. But the thing is that I want it to be the background like

background-color: #hexhere;

 but with a YouTube video. There is already a blur on the video so the text would be visible and more aesthetically pleasing. I would also need an h1 and a subtitle on the above the fold content.

Edited by Ryois
Title and Tag clearer
Link to post
Share on other sites

1 minute ago, zwirek2201 said:

I found 2 examples online that may help you achieve what you need. First of them uses pure CSS and second of them uses CSS and JS.
 

 



Hope it helps.

I have tried both of these and it didn’t really work that well.

Link to post
Share on other sites

2 minutes ago, zwirek2201 said:

Could you elaborate on why they didn't work for you?

I am on a iPad right now so I can’t really modify it easily but it would scroll with the video, and I want the video to be stationary. 

Link to post
Share on other sites

2 minutes ago, Ryois said:

I am on a iPad right now so I can’t really modify it easily but it would scroll with the video, and I want the video to be stationary. 

In the second example it does indeed scroll, but I just tried inserting many paragraphs to the first example to make it scrollable and video stays in the background and does not scroll.

Try, fail, learn, repeat...

Link to post
Share on other sites

1 hour ago, zwirek2201 said:

In the second example it does indeed scroll, but I just tried inserting many paragraphs to the first example to make it scrollable and video stays in the background and does not scroll.

trying it rightnow..

Link to post
Share on other sites

If you still haven't figured out how to solve that scrolling problem, I suggest you to make 2 containers, one being the background with a z-index of 0 and the other where you will actually build your html with a z-index of any number bigger than 0. Now you embed the video using the html5 video tag with the src being the URL to the YouTube video inside the first container, then, in the CSS, you define the container as "position: fixed", "left: 0px", "top: 0px" and set width and height to 100%, then in the video tag you set css as a "object-fit: cover" and "height: 100%" and "width: 100%". I think thats it hahaha

Link to post
Share on other sites

2 minutes ago, Rechdan said:

If you still haven't figured out how to solve that scrolling problem, I suggest you to make 2 containers, one being the background with a z-index of 0 and the other where you will actually build your html with a z-index of any number bigger than 0. Now, to embed the video, you use the html5 video tag with the src being the URL to the YouTube video then, in the CSS, you define this video tag as a "object-fit: cover" and "height: 100%" and "width: 100%". I think thats it hahaha

gonna try that later cant really code on an iPad...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×