I am new to HTML/CSS. I have created my first website using Cargo.
In a section where I have some videos, I'm trying to place their titles over them while keeping them responsive.
Viewing the website on a wide monitor makes the titles look a bit off, and on mobile, they are completely misplaced. I have tried creating a grid, but I wasn't successful with it.
This is an example of the HTML & CSS I use for the videos and titles (I know it's a mess).
Link to the website constantinesko.com/Sounds-1 to let you understand my issue better.
UPDATE: I've managed to wrap my videos with my titles making them responsive, thanks to the answer below. The last issue I'm facing now is that I can't make the titles align left on each video. I tried using text-align:"left"; but it didn't work and it seems like if I move the titles with the left:50%; or transform: translate(-50%,-50%); they stop being responsive.
Example using left:15%; :
27 inch monitor (https://prnt.sc/w1oxu9_0-tJ5)
Wide monitor (https://prnt.sc/fOlRR0HHsd2g)
<div class="video-container">
<div class="vcontainer">
<video id="vid1" preload="auto" onloadstart="this.volume=0.9" onmouseover="this.play()" onmouseout="this.pause()" loop="loop" width="100%" height="240px" poster="https://freight.cargo.site/t/original/i/75971115b3c32e4fdff42672cceb851cec352ac0d47b9fa22e985591df3f80ec/Metron_01_Cropped_Thumpnail.png" class="">
<source src="https://skovideos.s3.us-west-2.amazonaws.com/9+Sec+Metron+01+Cropped.mp4" type="video/mp4">
</video>
<div class="title">
<a href="https://constantinesko.com/Metron-01%22%3E">
<div class="linkbox"> METRON 01 </div></a>
</div>
</div>
.video-container {
display: flex;
flex-direction: column;
justify-content: center;
}
.vcontainer {
width: 100%;
height: 240px;
position: relative;
margin-bottom: 2%;
}
.title {
width: auto;
height: auto;
display: block;
position: absolute;
font-family: "Monument Grotesk Variable", Icons;
font-size: 2vw;
font-style: normal;
font-weight: 400;
font-variation-settings: 'slnt' 0, 'MONO' 0;
animation-duration: 1.5s;
animation-name: slidein;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 3;
}
#vid1{
width: 100%;
height: 240px;
z-index: 2;
}