Question:easy

Write the HTML code to embed an audio file named song.mp3 into a webpage. Ensure that the audio plays automatically.

Show Hint

Use the audio tag. Which attribute starts the sound without a click?
Updated On: Nov 3, 2026
Show Solution

Solution and Explanation

Step 1: Plan the code in three small pieces:
Piece 1: the tag, which is <audio>. Piece 2: the file, which is given with src. Piece 3: automatic play, which is given with autoplay.

Step 2: Put the pieces together:
Start with <audio, add src="song.mp3", add autoplay, add controls for the buttons, close the start tag with >, and end with </audio>.

Step 3: Final code:
<audio src="song.mp3" autoplay controls></audio>


Final Answer:
Audio tag, src for the file and autoplay for automatic start. \[ \boxed{\text{audio tag with src and autoplay}} \]
Was this answer helpful?
0