Open In App
Related Articles

HTML | <source> src Attribute

Improve Article
Save Article
Like Article

The HTML <source> src attribute is used to specify the URL of the media resource. The source element is used as a child element of the <audio> and <video> element. 


<source src="URL">

Attribute Values: It contains single value URL which specifies the URL of the media resource. There are two types of URL link which are listed below:

  • Absolute URL: It points to another webpage.
  • Relative URL: It points to other files of the same web page.

Below example illustrates the <source> src attribute in HTML: 



<!DOCTYPE html>
        HTML source src Attribute
<body style="text-align:center;">
    <h1 style="color:green;">
    <h2>HTML Source src Attribute</h2>
    <audio controls>
        <source id="mySource" src="gameover.wav"
        <source src="gameover.ogg" type="audio/ogg">



Supported Browsers: The browser supported by HTML <source> src attribute are listed below:

  • Google Chrome 
  • Edge 12
  • Internet Explorer 9.0
  • Firefox 3.5
  • Safari 
  • Opera 
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 19 Jul, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials