Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML src attribute

  • Last Updated : 02 Sep, 2021

The html src attribute is used to specify the location (URL) of the external resource.

Supported tags:  

Attribute Values: It contains single value URL which specifies the link of source file. 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 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>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>GeeksforGeeks</h1>
 
    <h2>HTML img src Attribute</h2>
 
    <img src=
        alt="GeeksforGeeks logo">
</body>
 
</html>

Output:  

Supported Browsers: The browsers supported by HTML src attribute are listed below: 
 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!