HTML 5 Video stretch

Viewed 110583

Can you make a video "stretch" to the width & height of the video element? Apparentlyby default, video gets scaled & fitted inside the video element, proportionally.

thanks

6 Answers

The main thing is setting the object-fit property to fill for the video component, then you can choose any arbitrary values in the video-cover for the aspect ratio

video {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.video-cover {
  width: 50vw;
  height: 30vw;
  margin: 2rem;
  background: #2c3e50;
}
<div class="video-cover">
  <video></video>
</div>

Related