![]() |
Definition and UsageThe Applies toThe
Browser SupportThe |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The audio src attribute</h1>
<p>Click on the play button to play a sound:</p>
<audio src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" controls>
Your browser does not support the audio element.
</audio>
<p><b>Note:</b> The .ogg fileformat is not supported in IE or Safari.</p>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The embed src attribute</h1>
<embed src="https://horje.com/avatar.png">
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The iframe src attribute</h1>
<iframe src="https://horje.com">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The img element</h1>
<img src="https://horje.com/avatar.png" alt="Girl in a jacket" width="500" height="600">
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The input src attribute</h1>
<p>Click on the image, and the input will be sent to a page on the server called "/action_page.php".</p>
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="image" src="https://horje.com/avatar.png" alt="Submit" width="48" height="48">
</form>
<p><b>Note:</b> The image input type sends the X and Y coordinates of the click that activated the image button as default.</p>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The script src attribute</h1>
<script src="demo_script_src.js">
</script>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The source element</h1>
<p>Click on the play button to play a sound:</p>
<audio controls>
<source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/ogg">
<source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>
Example:
HTML
<video width="320" height="240" controls>
<source src="https://www.sample-videos.com/video321/mp4/360/big_buck_bunny_360p_10mb.mp4" type="video/mp4">
<source src="https://www.sample-videos.com/video321/mp4/360/big_buck_bunny_360p_10mb.mp4" 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>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The video src attribute</h1>
<video width="320" height="240" controls src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_30mb.mp4">
Your browser does not support the video tag.
</video>
<p><b>Note:</b> The .ogg fileformat is not supported in old IE and Safari.</p>
</body>
</html>
html src attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded: | 1 week ago |
Uploaded by: | Admin |
Views: | 26 |
Reffered: https://www.w3schools.com/tags/att_src.asp