Structure of hero banner:
<div className="hero-banner">
<video autoPlay muted loop playsInline className="hero-banner__video">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
<source src="video.ogv" type="video/ogg" />
Your browser does not support the video tag.
</video>
<div className="hero-banner__overlay"></div>
<div className="hero-banner__content">
<h1>Awesome Banner Content</h1>
<p>This is some text content appearing on top of the video.</p>
</div>
</div>
Style of hero banner:
Approach 1:
.hero-banner {
position: relative;
width: 100%;
height: 100vh;
&__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #01f150;
mix-blend-mode: color;
}
}
&__content {
position: absolute;
bottom: 50px;
left: 50px;
color: #fff;
z-index: 1;
}
}
Approach 2:
.hero-banner {
position: relative;
width: 100%;
height: 100vh;
&__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
&__overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #01f150;
mix-blend-mode: color;
z-index: 1;
}
&__content {
position: absolute;
bottom: 50px;
color: #fff;
z-index: 2;
}
}
I tried using mix-blend-mode: multiply; as well, which works on iPhones and iPads Safari with expected tint shade but on Chrome it's behaving differently.
Additionally, I have used the same property with banner images or overlay on hover effect for some components and it's working for every component except <video> component.