HTML src attribute

src attribute represents the location of external resources such as image, media, pages, scripts, external style sheets etc.

<video src="files/Hummingbird.mp4" width="350" height="350" controls>

Attribute values

All possible values of src attribute

The value of src attribute is a valid URL.

Related Tags

The tags that support src attribute

<audio> tag

audio element adds an audio stream in a page.src attribute contains the address of audio.

<audio src="files/sample.mp3" controls></audio>

<embed> tag

embed element can embed the image, media or other pages. It also supports src attribute.

<embed src="files/start.html" type="text/html">

<iframe> tag

iframe element is an inline frame that represents the browsing content.

<iframe src="files/demo.html" > </iframe>

<img> tag

img element adds an image in the page.

<img src="files/logo.png" alt="logo" width="300">

<source> tag

source element is nothing on its own. But it is useful when used with other elements. For example, It can be used to add media.

<video  controls> 
<source src="files/Hummingbird.mp4" type="">

<video> tag

video element adds video in the page. The location of the video is specified by the src attribute.

Was this article helpful?