.d1 {
background-color: #f1f2f4;
display: flex;
padding: 4%;
}
.video-container {
flex: 1;
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
}
.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.d1>.text {
flex: 1;
}
<div class="d1">
<div class="video-container">
<iframe src="https://www.youtube.com/embed/Vbg81kc56FU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="text">
Test
</div>
</div>
I use a flexbox that consists of a left and right part, both of equal width. On the left, I am trying to insert a youtube video that should be responsive but, from my attempts, it does not keep its aspect ratio but appears to have more height. How can I fix this?