Skip to navigation

HTML Tag: source

Alternative media resource for video and audio elements. A browser should embed the first resource it can — if it gets befuddled with one, it can move on to the next in a list.

source elements should only be used if their video or audio parent does not have a src attribute.

source has no content and therefore does not warrant a closing tag.

Required Attributes

Attribute Description Possible values
src The location of the alternative media file to be used. URL.

Optional Attributes

Attribute Description Possible values
type The type of the resource. MIME type, potentially with a codecs parameter.
Global attributes


<video controls>
    <source src="kitties.mp4" type="video/mp4; codecs='avc1, mp4a'">
    <source src="kitties.webm" type="video/webm; codecs='vp8.0, vorbis'">
    <p>Browser no likey HTML 5.</p>