How do you add a color overlay to a video like this, as seen here:
Here is my code so far:
HTML
<div>
<div id="outer">
<div id="home-top-video">
<video autoplay loop muted width="100%">
<source src="http://view.vzaar.com/2710053.mp4" type="video/mp4" /> Your browser does not support the video tag. We suggest you upgrade your browser.
</video>
<div id="home-text">
<div><img src="http://marquesslondon.herokuapp.com/images/logo.ee1689ee.png"></div>
<h3>LIFESTYLE</h3>
</div>
</div>
</div>
</div>
CSS
#outer {
width: 100%;
display: block;
text-align: center;
position: relative;
overflow: hidden;
min-height: 100vh;
}
#home-top-video {
left: 0%;
top: 0%;
height: 100vh;
width: 100%;
overflow: hidden;
position: absolute;
z-index: -1;
}
#home-text {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
Fiddle here: https://jsfiddle.net/kggv3213/1/
We can use the property to provide an overlay to the background image. We can use the background-blend-mode property after setting the background image. For example, create a div in HTML. In CSS, set the background image using the url() function and set the no-repeat and fixed values in the background property.
Based on MDN Web Docs you can set multiple background using shorthand background property or individual properties except for background-color . In your case, you can do a trick using linear-gradient like this: background-image: url('images/checked. png'), linear-gradient(to right, #6DB3F2, #6DB3F2);
you can try pseudo element with gradient background:
body {
margin:0;
}
#outer {
text-align: center;
position: relative;
overflow: hidden;
min-height: 100vh;
}
#home-top-video:before {
content:"";
position: absolute;
top:0;
right:0;
left:0;
bottom:0;
z-index:1;
background:linear-gradient(to right,rgba(65, 0, 255, 0.4),rgba(255, 0, 232, 0.3));
}
#home-top-video {
left: 0%;
top: 0%;
height: 100vh;
width: 100%;
overflow: hidden;
position: absolute;
z-index: -1;
}
#home-text {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
z-index:1;
}
<div id="outer">
<div id="home-top-video">
<video autoplay loop muted width="100%">
<source src="http://view.vzaar.com/2710053.mp4" type="video/mp4" /> Your browser does not support the video tag. We suggest you upgrade your browser.
</video>
<div id="home-text">
<div><img src="http://marquesslondon.herokuapp.com/images/logo.ee1689ee.png"></div>
<h3>LIFESTYLE</h3>
</div>
</div>
</div>
Keep it simple, just add
#home-top-video:before {
content: '';
position: absolute;
height: 100%;
width: 100%;
background: rgba(255,0,255,0.2); //Change as per your requirement
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With