HTML

HTML Video

The HTML <video> element is used to display video content on a webpage.

<video controls>

    <source
        src="video.mp4"
        type="video/mp4"
    >

</video>

Important Attributes

AttributeDescription
controlsDisplays video controls
autoplayStarts video automatically
mutedStarts video without sound
loopRepeats video
widthSpecifies video width
heightSpecifies video height
posterDisplays an image before playback
<video
    width="600"
    controls >

    <source
        src="video.mp4"
        type="video/mp4"
    >

    Your browser does not support the video element.

</video>

Video with Poster Image

<video
    width="600"
    controls
    poster="thumbnail.jpg" >

    <source
        src="video.mp4"
        type="video/mp4"
    >

</video>

Autoplay Video

Modern browsers generally require autoplay videos to be muted.

<video
    width="600"
    autoplay
    muted
    loop >

    <source
        src="video.mp4"
        type="video/mp4"
    >

</video>
Interactive Sandbox
HTML/CSS/JS