JSFiddle - React, Tailwind, and code Playground
HTML
<div class="el">
<div class="el__content">
<video controls>
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
<source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>
</div>
<div class="el el--type-2">
<div class="el__content">
<img src="https://www.fillmurray.com/240/560" alt="">
</div>
</div>
<div class="el">
<div class="el__content">
<img src="https://www.fillmurray.com/440/560" alt="">
</div>
</div>
<div class="el el--type-2">
<div class="el__content">
<img src="https://www.fillmurray.com/440/440" alt="">
</div>
</div>
CSS
*,
:before,
:after {
box-sizing: border-box;
}
img,
video {
max-width: 100%;
height: auto;
vertical-align: middle;
}
.el {
position: relative;
}
.el:before {
content: '';
position: absolute;
z-index: 1;
top: 0;
left: 0;
right: 20%;
bottom: 0;
background: blue;
}
.el__content {
position: relative;
z-index: 2;
padding: 20% 0 7.5% 15%;
}
.el__content>* {
width: 100%;
}
.el.el--type-2:before {
top: 0;
left: 0;
right: 0;
bottom: 40%;
}
.el.el--type-2 .el__content {
padding: 20% 20% 0 0;
}
/* Просто для примера, чтобы элемент не был огромным */
.el {
max-width: 400px;
margin-bottom: 50px;
border: 1px solid red;
}