Posted on

How To Add Background Audio To A Webpage HTML5

Background audio html5

How To Add Background Audio To A Webpage HTML5

We can add background audio to a webpage by simply adding just one or two lines of code.

It is simular to our first Code Talk articleabout The HTML5 Audio tag but we just replace the ” <controls>” tag with the <autoplay>” tag.

Here is an example.

<audio src=”My-Audio.mp3″ autoplay></audio>

As you can see above it is very easy to achieve this in HTML5. Simply copy the code above and paste it to your HTML any where in between the opening “<body>” and closing “</body>” tag, and remember to replace the “My-Audio.mp3” with your audio source and you are good to go.

There are some limitations when using this example more information can be seen in our article here.

For our music production and composition please visit our website at Mootzart

Leave a Reply

Your email address will not be published. Required fields are marked *