There are two ways to add background music to a Web page, the first of which is to add through a normal <bgsound> tag, and the other is to add it through the <embed> tag.
(i) Use of <bgsound> labels
With Dreamweaver open the page that needs to add background music, click "Code" to open Code edit view, enter "<" between <body></body> to select Bgsound in the pop-up Code hint box.
Dreamweaver automatically enter the "<bgsound" code and press the SPACEBAR, the Code tip box automatically lists the properties of the BGSOUND tag for your choice. Bgsound label has five properties, of which balance is set music to the left and right balance, delay is the setting of playback delay, loop is the control of the number of cycles, SRC is the path of our music files, volume is the volume settings. In general, when adding background music, we do not need to the music around the balance and delay settings, so only a few major parameters can be. The final code is as follows:
<bgsound src= "Music.mid" loop= "-1" >
Among them, loop= "-1" means music infinite loop playback, if you want to set the number of playback, then change to the corresponding number.
This method of adding background music is the most basic method, is also the most commonly used method, for the background music format support now most of the mainstream music format, such as WAV, MID, MP3 and so on. If you want to take into account the low speed of the viewer, you can use mid sound as a background music for your Web page, because mid music files are small, so that you can quickly load and play in the process of opening a Web page, but mid also has a shortage of places, it can only store the melody of music, there is no good harmony and lyrics. If you have a fast internet connection, or if you think mid music is a bit monotonous, you can also add MP3 music. Just change the happy.mid in the above code to Happy.mp3.
Hint: It is more convenient to add background music to FrontPage than Dreamweaver, as long as you can set it in the Background dialog box.
(b) Use of <embed> labels
The use of <embed> tags to add music is not very common, but it is very powerful, if you combine some of the playback controls can create a Web player.
It uses the same method as the first basic, just the first step of the Code hint box do not choose Gbsound, change and choose embed can. And then select its properties for the appropriate settings, from the diagram can be seen embed properties than gbsound five more than the number of properties. The final code is as follows: <embed src= "Music.mp3" autostart= "true" loop= "true" hidden= "true" ></embed>.
Where Autostart is used to set whether music plays automatically when the page is opened, and hidden sets whether the media player is hidden. Because embed is actually like a music player on a Web page, if it's not hidden, it will show the default media widget for your system.
For these two methods, I think both have advantages and disadvantages: The first method when the page opens music playback, if the page is minimized after the concert automatically paused, if you use the second method does not occur, as long as the window does not close, it will always play. So I hope everyone in the use of the process according to their own circumstances to choose the method of adding music.
Learn the simple way to add a Web page music, you should be in the interface and function up and down a bit. We can use the "Web music player" to create a stylish music player.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.