HTML Tutorial - HTML Music Code
You can add music to your web site, which can be played in several different ways. Music files can be played in the background, foreground, play once from the beginning to the end, or play continuously. The music on your web site can play hidden in the background or open a music player so the user can control how the music is being played.How To Add Music To A Web Site
Music can be added to a web site by utilizing the <embed> tag (standard for adding media to a web page), or by simply linking to the music file. Just like the <img> tag, the <embed> tag does not need a closing tag.Embedded music file:
<embed src="mozart.mid" />
How To Play Music In The Foreground (on click)
Link to music file:<a href="mozart.mid">Click to play music</a>Click to play music
This option will open the music file in a music player.
How To Play Music In The Background
To play music in the background without the media player showing, the attribute hidden="true" needs to be added to the <embed> tag.<embed src="mozart.mid" hidden="true" />
Automatic Music Play - Play Music File Once
To play the music file only once, the attribute autostart="true" needs to be added to the <embed> tag.<embed src="mozart.mid" autostart="true" />This will start playing music automatically.
Automatic Music Play - Play Music File Continuously
To play the music file continuously, the attribute loop="true" needs to be added to the <embed> tag.<embed src="mozart.mid" autostart="true" loop="true" />This will start playing music automatically and will keep playing the music file continuously.
Music Control Attributes:
- autostart - start music file automatically
- loop - repeat music file continuously
- volume - set the music volume. Allowed values are 0 - 100
Specify Height And Width For The Music Player
You can specify the width and the height for the music player using the embed attributes as described in the example below. The music player software used by the visitor will display with the specified height and width.<embed src="mozart.mid" width="50" height="20" />
Embedded Music Attributes:
- width - set the width for the music player
- height - set the height for the music player
- hidden - do not show the music player (music plays hidden in the background)
Adding Music To A Web Site Tips
Here are some tips you should consider when you add music to your web site:
Make sure the music on your web site is not too loud and scares people away. Also keep in mind that
your visitors might be in an office or a quiet place when they visit your web site, and sudden
loud music playing might be somewhat embarrassing for your visitors. If you are playing continuous music in the
background (hidden) make sure to give the user the option to turn the music off. Your visitors might
be annoyed by continuous music playing in the background and leave your site.
HTML Related Links
- How to Get a Web Site or Online Business Started
- CMS - Content Management System
- How to Choose and Register the Right Domain Name
- Making Revenue - How to Make Money With a Website
- Server and Hosting
© This Article is Copyrighted by WebmasterSeminar.com
Please do not copy or reproduce this article in whole or part, in any form, without mentioning the source and including a live link back to WebmasterSeminar.com - Thank You!LINK TO THIS TUTORIAL:
Copy the code below and paste into your web page
<a href="http://www.webmasterseminar.com/htmlmusic.php"> Webmaster Seminar</a><br /> HTML Music - Free Information, Tutorials and HTML Resources