Horje
HTML src Attribute

The tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed.


Examples of HTML src Attribute in Audio

It will play an audio playe.

index.html
Example: PHP
<audio src="horse.ogg" controls>
Your browser does not support the audio element.</audio> 

Output should be:

Examples of HTML src Attribute in Audio

Example of HTML src Attribute in Embed

It will appear an embedded flash animation.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>
<h1>
The embed src attribute</h1>
<embed src="https://horje.com/avatar.png">
</body>
</html>

Output should be:

Example of HTML src Attribute in Embed

Example of HTML src Attribute in Iframe

It will appear An <iframe> in its simplest use.

index.html
Example: HTML
<iframe src="/default.asp"></iframe>

Output should be:

Example of HTML src Attribute in Iframe

Example of HTML src Attribute in Img

It will appear an image is marked up as follows.

index.html
Example: HTML
<img src="smiley.gif" alt="Smiley face">

Output should be:

Example of HTML src Attribute in Img

Example of HTML src Attribute in Input

It will appear a HTML form with an image that represents the submit button.

index.html
Example: HTML
<form action="/action_page.php"> First name: <input type="text" name="fname">
<br> <input type="image" src="submit.gif" alt="Submit">
</form> 

Output should be:

Example of HTML src Attribute in Input

Example of HTML src Attribute in Script

It will point to an external JavaScript file.

index.html
Example: HTML
<script src="myscripts.js"></script>

Output should be:

Example of HTML src Attribute in Script

Example of HTML src Attribute in Source

It will play an audio player with two source files.

index.html
Example: HTML
 <audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio> 

Output should be:

Example of HTML src Attribute in Source

Example of HTML src Attribute in Track

It will play a video with two subtitle tracks.

index.html
Example: HTML
 <video width="320" height="240" controls> <source src="forrest_gump.mp4" type="video/mp4"> <source src="forrest_gump.ogg" type="video/ogg"> <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English"> <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>

Output should be:

Example of HTML src Attribute in Track





Related Articles
HTML Attributes HTML Attributes
How to create HTML href Attribute HTML Attributes
HTML src Attribute HTML Attributes
How to create HTML width and height Attributes HTML Attributes
How to create HTML alt Attribute HTML Attributes
How to create HTML style Attribute HTML Attributes
How to create lang Attribute HTML Attributes
How to create HTML title Attribute HTML Attributes
How to create HTML Single or Double Quotes HTML Attributes
HTML Headings HTML Attributes
How to create HTML Headings HTML Attributes
Headings Are Important HTML Attributes
How to create HTML Bigger Headings HTML Attributes

Single Articles
Examples of HTML src Attribute in Audio HTML Attributes
Example of HTML src Attribute in Embed HTML Attributes
Example of HTML src Attribute in Iframe HTML Attributes
Example of HTML src Attribute in Img HTML Attributes
Example of HTML src Attribute in Input HTML Attributes
Example of HTML src Attribute in Script HTML Attributes
Example of HTML src Attribute in Source HTML Attributes
Example of HTML src Attribute in Track HTML Attributes

Category :
Web Tutorial
Sub Category :
HTML Attributes
Uploaded by :
Admin


Read Article
https://horje.com/learn/1434/reference