Home  >  Article  >  Web Front-end  >  How to insert auto-playable audio (graphics and text) in html5

How to insert auto-playable audio (graphics and text) in html5

yulia
yuliaOriginal
2018-10-30 16:08:0429141browse

People who frequently browse websites or frequently layout pages should be familiar with audio and video on the page. Friends who are learning HTML5, do you know how to insert audio and automatically play it in HTML5? This article will study with you the audio tags in HTML5 and the code for inserting audio in HTML5. It has certain reference value and you can refer to it.

The

The content in the tags is used to display to browsers that do not support the audio tag.

Description of related tags needed to insert audio:

is used Set audio resources, generally used in

Note: Be careful when using the

How to insert auto-playable audio (graphics and text) in html5

Example Demonstration 1: How to insert audio in HTML5

Detailed explanation of the example:

First create an

<audio controls>
  <source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>

Rendering:

How to insert auto-playable audio (graphics and text) in html5

Example Demonstration 2: How to insert auto-playing audio in HTML5

Example description:

The autoplay attribute in the

The method of inserting autoplay audio in HTML5 is the same as the method of inserting audio introduced above, except that one more attribute is added, namely the autoplay attribute in the

<audio controls autoplay>
  <source src="horse.mp3" type="audio/mpeg">
  您的浏览器不支持 audio 元素。
</audio>

The above introduces how to insert audio in HTML5 and how to insert audio that can be played automatically. The explanation is detailed and easier to understand. Beginners can try it themselves, find an audio, and insert it into the page. See if your code can achieve the effect of automatic playback. I hope this article will be helpful to you!

【Recommended related tutorials】

1. Html5 Video Tutorial
2. HTML Development Manual
3. bootstrap tutorial
4. How to insert video in HTML5

The above is the detailed content of How to insert auto-playable audio (graphics and text) in html5. 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

Related articles

See more