HTML src attribute

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

Example


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

src attribute values

The value of src attribute is a valid URL.

Related Tags

The tags which support this attribute are as follows.

<audio> tag

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

Example


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

<embed> tag

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

Example


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

<iframe> tag

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

Example


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

<img> tag

img element adds an image in the page.

Example


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

<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

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

<video> tag

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

See the top most example.



Was this article helpful?

 

Email:

Message:

Get the newsletter