HTML Audio Tag
By Saket Bhatnagar••Beginner to Intermediate
audio tag
- 1The <audio> tag was introduced in HTML5.
- 2The <audio> tag is used to embed or attach audio to a web page.
- 3It is a container tag.
- 4It is block level element.
- 5To mention the path of audio we have to use <source> tag(Source tag is a non container tag.)
- 6In <source> tag we have to use 'src' attribute in which path of audio will be provided.(Syntax:- <source src='path-of-audio'>
- 7We can provide multiple sources using multiple <source> tags.
- 8The content written within <audio> tag will be displayed when <audio> tag is not supported by the browser.
- 9Syntax:- <audio> <source src='path-of-audio'> <source src='path-of-audio'> Audio tag is not supported by the browser. </audio>
Attributes of Audio tag
- 1Controls :- It is used to enable the controls of the audio like play,pause,volume control, etc.
- 2Autoplay :- It is used to automatically play the audio when the page is loaded.
- 3Loop :- It is used to play the audio continuously in a loop i.e, when the audio ends it is started again automatically.
- 4Muted :- It is used to mute the audio.