Click here to Skip to main content
11,577,710 members (63,033 online)
Click here to Skip to main content

Tagged as

Background Music in HTML 5

, 17 Jul 2011 CPOL 44.8K 3
Rate this:
Please Sign up or sign in to vote.
Playing background music in HTML 5.

In the following simple trick, I am going to show you how to play audio in the background using HTML 5:

<!DOCTYPE html>
<html>
  <link rel="stylesheet" href="styles.css">
  <title>Background Music</title>
 
  <audio autoplay loop>
      <source src="johann_sebastian_bach_air.ogg">
      <source src="johann_sebastian_bach_air.mp3">
  </audio
 
  <h1>You're hooked on Bach!</h1>
</html>

Kindly change the audio source name to your own.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mhamad zarif
Software Developer Netiks
Lebanon Lebanon
I have been a programmer for about one year.My power is in asp.net and flash (actionscript 3).I also work on windows application using vb.net and c#.

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 4 Pin
Ssntosh Chouhan10-Aug-13 19:40
memberSsntosh Chouhan10-Aug-13 19:40 
BugTypo Pin
Tiago Becerra Paolini1-Jan-13 14:01
memberTiago Becerra Paolini1-Jan-13 14:01 
Generalnot so bad..but also not so good...! Pin
vaibhav201029-Feb-12 2:29
membervaibhav201029-Feb-12 2:29 
Generalnot so bad..but also not so good...! Pin
vaibhav201029-Feb-12 2:29
membervaibhav201029-Feb-12 2:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 17 Jul 2011
Article Copyright 2011 by mhamad zarif
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid