JSFiddle - React, Tailwind, and code Playground
by darkstarsys
HTML
<div class="main">
<div class="video-wrapper">
<video class="video" src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4" controls="true"></video>
</div>
</div>
CSS
.main {
overflow: hidden;
/* TRY ASPECT RATIOS HERE
800w x 300h doesn't work -- bottom gets cut off */
width: 800px;
height: 300px;
background: red;
object-fit: contain;
}
.video-wrapper {
position: relative;
height: 0;
padding-bottom: 56.25%;
object-fit: contain;
}
.video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%; /* spec says no percent allowed here */
object-fit: contain;
}