×
   ❮     
HTML CSS MySql Javascript SQL PYTHON JAVA C++ C# BOOTSTRAP REACT XML NODEJS ANGULAR DJango Rust Android VUE
     ❯   

HTML Audio


How to insert Audio in HTML?

HTML audio element is used to play an audio file on a web page.

Linking to a sound file using a href allows a browser to open and play an audio file if the viewer of your web page has properly configured their Internet browser.


Example to insert audio in HTML

Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Audio Example</title>
  </head>

  <body>
    <h2>Audio Example</h2>

    <audio controls>
      <source src="../audio/jeffbob.mp3" type="audio/mp3">
      Your browser does not support the audio element.
    </audio>

  </body>
</html>
Try it Yourself »

The <audio> element is used to embed an audio player.

The controls attribute adds playback controls (play, pause, volume, etc.) to the audio player.

The <source> element is used to specify the audio file's source (src) and type (type). Multiple <source> elements can be used to provide alternative audio formats for better browser compatibility.


Hey there! Let's go for Learn fasta then! It is more than just coding; it is to have the superpower that can solve any problem. Through simple and easy-to-grasp examples you will sail through the learning process. In addition, it is not just about coding– you will acquire competencies on how to solve complex problems, analyze data, and come up with efficient solutions. Shall we start this wonderful journey together! learnfasta.com terms of use, Copyright 2025 All Rights Reserved.