audio Tag
The <audio>
tag allows you to play audio files such as mp3 and wav on a webpage.
Using the audio tag
<audio controls> <source src="your-audio.mp3" type="audio/mp3" /> Your browser does not support the audio element. </audio>
Key Attributes
The key attributes of the audio tag are as follows:
-
controls
: Displays controls to play, pause, adjust volume, etc. -
<source>
: Specifies the path and type of the audio file
Considerations for Using the <audio>
Tag
-
Alternative Text: The text written between the audio tags defines what will be displayed in browsers that do not support audio.
-
Consider Audio File Size: Large audio files can affect the loading time of a webpage. Therefore, it is advisable to use audio files as small as possible.
Mission
0 / 1
Which HTML tag is used to embed audio files on a web page?
<sound>
<music>
<audio>
<link>
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help