How to add background music to a web page? Just insert a behavior directly:
First, learn to add music files
Generally speaking, there are two ways to add background music to a web page. The first way is to add background music through ordinary tags, and the other way is to add background music through tags.
(a) Use tags
Use Dreamweaver to open the page where you need to add background music, click "Code" to open the code editing view, and enter "
Dreamweaver automatically enters "
bgsoundsrc=>
In which loop= means the music plays in an infinite loop. If you want to set the number of plays, change it to the appropriate number.
This method of adding background music is the most basic method and the most commonly used method. For background music formats, it supports most mainstream music formats, such as WAV, MID, MP3, etc. If you want to take into account browsers with lower Internet speeds, you can use MID sound effects as the background music of the web page. Because MID music files are relatively small, they can be loaded and played quickly when opening a web page. However, MID also has some disadvantages. It can only store the melody of the music, but not the nice harmonies and lyrics. If your Internet speed is fast or you feel that MID music is a bit monotonous, you can also add MP3 music. Just change happy.mid in the above code to happy.mp3
Tip: Adding background music in FrontPage is relatively more convenient than Dreamweaver, just set it in the background dialog box.
(2) Use tags
The method of adding music using tags is not very common, but it is very powerful. If you combine some playback controls you can create a web player.
The usage method is basically the same as the first one, except that in the code prompt box of the first step, instead of selecting gbsound, select embed. Then select its properties and set them accordingly (Figure 3). As can be seen from the figure, embed has many more attributes than gbsound's five attributes. The final code is as follows:
2. Click the "Insert" menu in the upper left corner of DW, click the "Media" option, and click "Plugins";
3. Find the file you want to insert in the folder Music file (MP3 format), click "OK";
4. Click the "Yes" option on the page that pops up, and then click "Save";
5. Then A small-shaped graphic will appear in the right interface of DW. Click and hold it with the left mouse button to make it larger, and then click the play button below;
6. If you click "Play", there will be no The sound will pop out of this page, click the "OK" option on the page;
7. Click a globe-shaped options menu on the upper left side of DW and select "Preview in IExplore";
< p>8. A page will pop up, click the "Yes" option, and then click the "Save" option;9. Jump to the IE browser and click "Allow blocked content" under the browser;
10. Music can be played and can be paused manually.
How to add background music in HTML code?
1. First, create a simple web page with only one DIV text content;
2. In the DIV text content of this web page, you can add background music Web page;
3. To add background music to the web page, you can use the embed tag and add the src attribute to it. This is used to specify the path where the music is located, embedsrc="tt.mp3"hidden=" true";
4. In order to hide the background music with this multimedia control, the embed tag adds the hidden attribute. To make the background music play automatically after opening the web page, we can add the autostart attribute, autostart=" true";
5. By default, the multimedia control will only play once and stop after playing. If you want the background music to play continuously, you can add the loopn attribute, loop="true".
How to add background music to a web page?
1. First, put the selected music files into the same file on the web page, as shown in the figure.
2. Open the webpage with Adobe Dreamweaver CS6 software, point the mouse at any location you want to place the music background in the webpage design bar, then select Insert/Media (M)/Plug-in (P) in the menu bar, and follow the path Select the MP3 file you need to set background music and double-click the left mouse button.
3. Click the mouse on the plug-in to see the property bar below. According to the property bar, we can adjust the background width arbitrarily. Save and refresh the web page to see that background music can be played automatically on the web page.
4. Select the plug-in in the software design bar, open the code bar, add a hidden="true" to the code height="64", save and refresh the web page, you will see that the music background has been hidden, and the music But it's still playing.
5. Set the music loop playback and play times: also add a section of loop="false" to the code height="64" to not replay loop="true" to loop playback loop="5" to play 5 times.
How to add background music in HTML?
1. First, create a simple web page with only one DIV text content;
2. In the DIV text content of this web page, you can add background music Web page;
3. To add background music to the web page, you can use the embed tag and add the src attribute to it. This is used to specify the path where the music is located, embedsrc="tt.mp3"hidden=" true";
4. In order to hide the background music with this multimedia control, the embed tag adds the hidden attribute. To make the background music play automatically after opening the web page, we can add the autostart attribute, autostart=" true";
5. By default, the multimedia control will only play once and stop after playing. If you want the background music to play continuously, you can add the loopn attribute, loop="true".
About css insertion of music?
How to insert music in css: There are generally two ways to add background music to a web page. The first is through ordinary