HTML Audio
The <audio> element lets a page play sound. You can add the controls attribute so the browser gives the visitor play, pause, and volume controls. The src attribute can point to an audio file, or you can use <source> elements when you want to provide different formats. Audio can be useful for music, lessons, pronunciation, podcasts, and sound effects. Give the visitor controls when they need to decide when sound should play.
Why this matters
- ·Audio can add spoken lessons and other sound to a page.
- ·The browser can provide native playback controls.
- ·Multiple source formats can improve compatibility.
Common mistakes
- ·Unexpected autoplay can annoy visitors.
- ·Large audio files can slow pages.
- ·Do not hide important information only inside audio without a text alternative.
Advertisement
Your codeHTML
Live preview
Advertisement
Frequently asked questions
It asks the browser to show playback controls.
Advertisement
Practice questions
Question 1
Add an audio player with controls.
Your codeHTML
Live preview
Question 2
Add an audio source with fallback text.
Your codeHTML
Live preview
Quick check
Just for this topic answer honestly, then check yourself.
1 / 3
