Web4College

HTML src attribute

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

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

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.

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

<embed> tag

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

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

<iframe> tag

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

Example
Try it
<iframe src="files/demo.html" > </iframe>

<img> tag

img element adds an image in the page.

Example
Try it
<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.

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

<video> tag

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