HTML src attribute
The html src attribute is used to specify the location (URL) of the external resource.
Supported tags:
Attribute Values: It contains a single value URL that specifies the link of the source file. There are two types of URL links which are listed below:
- Absolute URL: It points to another webpage.
- Relative URL: It points to other files of the same web page.
Example: HTML audio src attribute
html
<!DOCTYPE html> < html > < head > < title > HTML audio src Attribute </ title > </ head > < body style = "text-align:center;" > < h1 style = "color:green" > GeeksforGeeks </ h1 > < h2 > HTML audio src Attribute </ h2 > < audio controls muted> < source src = "GFG.mp3" type = "audio/mp3" > < source src = "GFG.ogg" type = "audio/ogg" > </ audio > </ body > </ html > |
Output:

Example: HTML img src Attribute
html
<!DOCTYPE html> < html > < head > < title > HTML img src Attribute </ title > </ head > < body > < h1 style = "color:green" > GeeksforGeeks </ h1 > < h2 >HTML img src Attribute</ h2 > < img src = alt = "GeeksforGeeks logo" > </ body > </ html > |
Output:
.png)
Supported Browsers: The browsers supported by HTML src attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Please Login to comment...