", ""."/> ", "".">

Home  >  Article  >  Web Front-end  >  How to make html play music

How to make html play music

WBOY
WBOYOriginal
2021-11-10 18:10:3232656browse

In HTML, you can insert a music player on the web page to play music through the audio tag, the syntax is "", " ".

How to make html play music

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

How to make html play music:

1. We open the html file and make sure a project is open.

How to make html play music

#2. We need to make sure that the music file to be imported is in the html folder. You can drag a music file to the folder where the HTML file is located.

How to make html play music

3. You can create a music player through the audio tag.

You can use the src attribute of the audio tag, which is the path to the music file. The code is as follows:

<audio src="1132.mp3" controls>
</audio>

How to make html play music

Another method is to insert the source tag in the audio tag to introduce the path of the music file. The code is as follows:

<audio controls> 
   <source src="1132.mp3">
   </audio>

How to make html play music

4. Open this html file, and you will see a controllable music player on the web page.

How to make html play music

#From this we have completed playing music in html.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of How to make html play music. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn