How do you make an HTML video responsive?

Make an HTML video responsive by letting it fill the available width while preserving the media’s aspect ratio. A native video element has intrinsic dimensions, but fixed CSS width and height can still force distortion or overflow. Use width 100 percent with height auto for ordinary inline video.
<video class='article-video' width='1280' height='720' controls preload='metadata' poster='demo-poster.webp'>
<source src='demo.webm' type='video/webm'>
<source src='demo.mp4' type='video/mp4'>
</video>
.article-video {
display: block;
width: 100%;
height: auto;
}
The HTML dimensions reserve a 16:9 area before the poster or video metadata loads. Use dimensions that match the actual media ratio. If the design puts video in a fixed card, set an aspect ratio on the box and use object-fit cover only when cropping the footage is acceptable. Controls must remain inside the visible frame.
Add the controls attribute unless the interface provides accessible custom controls. Autoplay policies vary, especially on phones; muted inline video has a better chance of autoplaying, but users may still block it. Use playsinline when inline playback is intended on mobile and provide captions for spoken content.
Video bytes matter more on mobile connections. Choose an appropriate resolution and bitrate, provide more than one codec when the audience requires it, and avoid preloading a large file that starts below the fold. A poster image should match the video ratio so its replacement does not resize the element.
Test the video on a real iPhone and Android device in both orientations. Verify play, pause, seeking, captions, full screen and keyboard focus. Check that controls do not become too small at the narrowest width and that entering or leaving full screen does not leave the page scrolled to an unexpected position.