HTML Introduction

HTML Basic Syntax

HTML Block Element

HTML Formatting

HTML Quotation

HTML Links

HTML List

HTML Table

HTML Audio

HTML Video

HTML Image

HTML Iframe

HTML Favicon

HTML Form

HTML Input Types

HTML Marquee

HTML Meta tag

Learn CSS

Learn Javascript

Learn Django

HTML audio related work

How to add audio in a html page?

We use audio tag for add audio in the html page.In audio tag there is a attribute name src means source. We give the path/name.extension in the src attribute. After giving correct path, we can show audio in html page. If the html file and audio file is in the same folder then you don't need to pass the file path. But if both files are in different folder then you must give the path of the audio file. We can also give link if we want take file from internet.

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<audio src="my_audio.mp3"></audio>
<audio src="F:\HTML/my_audio.mp3"></audio>

</body>
</html>

Some attributes of audio tag:

1.Controls: We use controls attribute and pass controls as value so that user can control the audio track.
2.autoplay: We use autoplay attribute and pass autoplay as value for autoplay audio after loading the page.
3.preload: we use preload attribute and give auto as value to preload the audio track.
4.muted: we use muted attribute and pass muted as value to create mute option.
5.loop: We use loop attribute and pass loop as value for autoplay audio after ending.

If we write something message before the audio ending tag then it will be displayed if the browser doesn't support the audio format .

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<audio src="my_audio.mp3" controls="controls" autoplay="autoplay" preload="auto"></audio>
<audio src="F:\HTML/my_audio.mp3" muted="muted" loop="loop"></audio>

</body>
</html>

CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

© Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.