In HTML, you can insert a music player on the web page to play music through the audio tag, the syntax is "", " ".
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.
#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.
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>
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>
4. Open this html file, and you will see a controllable music player on the web page.
#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!
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