Playing Sound In Hidden Tag

I agree with the sentiment in the comments above — this can be pretty annoying. We can only hope you give the user the option to turn the music off.

However…

audio { display:none;}
<audio autoplay="true" src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg">

 Run code snippetExpand snippet

The css hides the audio element, and the autoplay="true" plays it automatically.

Leave a Comment