HTML Video: Posters, Size and Playback
Embed a video
video displays moving pictures and can include sound. Give it a source, native controls, and dimensions in CSS pixels. The supplied clip is two seconds of a blue screen with a steady tone. These examples use the original files in media-fixtures/; open the supplied preview from a local static server or place the files at the shown paths.
<video src="media-fixtures/demo.webm" controls width="160" height="90"></video>The player occupies a 160 by 90 CSS-pixel region before any responsive CSS.
Show a poster
poster points to a still image that can be displayed before the video is playing. It is not an alternative for captions or a transcript. Matching width and height to the intended aspect ratio helps reserve space.
<video src="media-fixtures/demo.webm" poster="media-fixtures/poster.svg" controls width="160" height="90" preload="none"></video>The poster can be displayed before the first frame.
Request inline and muted playback
playsinline requests playback within the page rather than a fullscreen-only presentation. muted sets the initial muted state. Browsers may block autoplay, especially audible playback, so provide controls and do not depend on autoplay.
<video src="media-fixtures/demo.webm" controls muted playsinline width="160" height="90"></video>The video starts muted when the user plays it; inline presentation is requested.
Common mistakes and practice
A poster is not an alt attribute. Use captions for meaningful audio and a description for important visual information. Do not assume mobile fullscreen or autoplay policies are identical across browsers.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Video: Posters, Size and Playback — Knowledge Check
Apply the media or embedding concepts from this lesson.
What does poster provide?
What does playsinline request?
Why keep controls if autoplay is desired?
Which attributes can reserve the intended video display dimensions?
What does muted change initially?