Free Web Development Online Tutorials, Learn to Code
Learn HTML5 Syntax, Webpage Designing using HTML, HTML5 Tags, HTML Tutorial for Beginners

audio tag in HTML5

Html5 audio tag will allow you to embed any audio clip in your webpage with just one line code.

HTML5 Audio Tag Example

Syntax for Single Audio File
<audio src="~/sound/file1.mp3" controls="controls" />

Syntax for Multiple Audio Files

   
<audio controls="controls" autoplay="autoplay" loop="loop">
<source src="~/sound/file1.mp3">
<source src="~/sound/file2.mp3">
</audio>

audio tag attributes

Here are few important attributes for audio

  • audio src

    this property is for setting up the file source, like source src="~/suound/file1.mp3"

  • autoplay

    autoplay="autoplay" This Boolean attribute specifies that if the audio will automatically start playing, the value is "autoplay" which means "true".

  • controls

    controls="controls" , Indicates browsers will display the control, that will allow the user to control audio play/pause, volume etc.

  • loop

    loop="loop" Indicates that audio will automatically start over again.

  • muted

    muted="muted" , if the property value set to muted then, then the audio will be muted when loaded for the first time.

HTML5 is very demmanding skill for Web Developer or Web Designer

Comment
Name
Email
Website
Subscribe
 
Audio Tag in HTML5
Web Designing Tutorials


HTML5 Tags Examples | Join Web Design Course