HTML | <source> src Attribute
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.
Syntax:
<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:
Example:
<!DOCTYPE html> <html> <head> <title> HTML source src Attribute </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>HTML Source src Attribute</h2> <audio controls> <source id="mySource" src="gameover.wav" type="audio/mpeg"> <source src="gameover.ogg" type="audio/ogg"> </audio> </body> </html> |
Output:

Supported Browsers: The browser supported by HTML <source> src attribute are listed below:
- Google Chrome 4.0
- Internet Explorer 9.0
- Firefox 3.5
- Safari 4.0
- Opera 10.5
Recommended Posts:
- HTML | <a> rel Attribute
- HTML | rel attribute
- HTML src attribute
- HTML | <map> name Attribute
- HTML | for Attribute
- HTML | name Attribute
- HTML | max attribute
- HTML | <img> src Attribute
- HTML | <bdo> dir Attribute
- HTML | <li> value Attribute
- HTML | alt attribute
- HTML | low Attribute
- HTML | <img> alt Attribute
- HTML | min Attribute
- HTML | dir Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




