Question:

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
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Understanding the Question:
We need the HTML tag that plays sound, the file name, and the attribute that starts playing on its own.

Step 2: Choose the tag:
The <audio> tag embeds sound in a page. The file name goes in its src attribute: src="song.mp3".

Step 3: Add autoplay:
The autoplay attribute makes the audio start as soon as the page loads. The controls attribute adds play and pause buttons, so the user can stop it.

Step 4: Write the code:
<audio src="song.mp3" autoplay controls></audio>


Final Answer:
The audio tag with src and the autoplay attribute does the job. \[ \boxed{\text{audio tag with src and autoplay}} \]
Was this answer helpful?
0
0

Top CBSE X Questions

View More Questions