Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Attributes

0/1

HTML Paragraphs

0/1

HTML Formatting

0/1

HTML Comments

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML Symbols

0/1
Text lesson

HTML <audio> Autoplay

To automatically start playing an audio file, use the autoplay attribute:

Example

<audio controls autoplay>
  <source src=”horse.ogg” type=”audio/ogg”>
  <source src=”horse.mp3″ type=”audio/mpeg”>
Your browser does not support the audio element.
</audio>
Note that in Chromium browsers, autoplay is generally restricted, but muted autoplay is consistently permitted.

Include the muted attribute after autoplay to enable your audio file to start playing automatically (but muted):

Example

<audio controls autoplay muted>
  <source src=”horse.ogg” type=”audio/ogg”>
  <source src=”horse.mp3″ type=”audio/mpeg”>
Your browser does not support the audio element.
</audio>

Browser Support

The numbers in the table indicate the earliest browser version that fully supports the <audio> element.

da3fa333-bb23-4831-ba7e-a34a4864d628