Key Ideas
1The video Element. The most important video attribute beyond controls is poster — the image shown before playback starts. Without it, the video shows a black frame (or the first frame) w...
2Video Formats & Attributes
FormatMIME typeChromeFirefoxSafariNotes
MP4 / H.264video/mp4YesYesYesUniversal — safest single format
WebM / VP9video/webmYesYes14.1+Smaller than MP4 at same quality
OGG / Theoravideo/oggYesYesNoOutdated — avoid
Strategy: Encode WebM (VP9) as the first <source> (smaller file, Chrome/Firefox pick it) and MP4 (H.264) as the fallback (Safari + universal compatibility).
controlsbooleanShows native play/pause, seek bar, volume, fullscreen
posterURL stringImage shown before playback starts — use a custom thumbnail
autoplaybooleanBlocked by browsers unless muted is also present
mutedbooleanStarts muted. Required to allow autoplay
loopbooleanRestarts video when it ends
playsinlinebooleaniOS: plays in-page instead of fullscreen. Required for background/looping videos on iPhone
preload"none"|"metadata"|"auto"Download hint. Use "metadata" for videos above the fold
width / heightinteger (px)Intrinsic dimensions — reserve space, prevent layout shift
Section 3
Captions with <track>. The <track> element adds synchronized text to a video. Captions are mandatory for accessibility compliance (WCAG 2.1 AA, ADA). The file format is WebVTT (.vtt) —...
3Responsive Video. By default <video> is a fixed-width element. To make it fluid — expanding to fill its container while maintaining aspect ratio — use the modern aspect-ratio CSS ...