I have a video
nested in a parent div
. I would like to set its opacity
to a linear-gradient
transparency effect from left to right, 100% to 0%
. The idea is to see the video at 100% opacity
on the left side and at 0%
on the right side.
CONTEXT: The overall goal is to blend two videos together with a different linear-gradient
opacity
when hovering different text-item
elements.
My current code:
HTML
<div class="media">
<video class="media__item" autoplay muted>
<source src="src.mp4" type="video/mp4" />
Your browser doesn't support the video tag.
</video>
</div>
CSS
.media {
width: 320px;
height: 240px;
}
.media__item {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
opacity: 50%; /* this is wrong */
}