How to make html play music

WBOY
Release: 2021-11-10 18:10:32
Original
32598 people have browsed it

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>
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!