Add music to your HTML web page
You can add background music to your web page in HTML using <embed > or <audio> tag.
<embed> tag is used to embed multimedia content into an HTML document. You can set loop as true as autostart as true to make sure your music is played when you web page is opened and it doesn’t stop.
<embed src="/music/bgm.mp3" loop="true" autostart="true" width="5" height="0">
Another way to embed audio to your html page is to use <audio> tags.
<audio controls="controls"> <source src="media/bgm.mp3" type="audio/mpeg"> <source src="media/bgm.ogg" type="audio/ogg"> Your browser does not support the HTML5 Audio element. </audio>
We can specify multiple sources of audio inside the <audio> tag to make sure your audio plays in all browsers.
Curly hair, very fair, please share 🙂
Leave a Reply