Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML src attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:  

 

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
Last Updated : 10 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials