You create your elements like so...

<audio id="yourAudio" preload='none'>
    <source src='the url to the audio' type='audio/wav' />
</audio>
<a href="#" id="audioControl">play!</a>

And add some functionality:

var yourAudio = document.getElementById('yourAudio'),
    ctrl = document.getElementById('audioControl');

ctrl.onclick = function () {

    // Update the Button
    var pause = ctrl.innerHTML === 'pause!';
    ctrl.innerHTML = pause ? 'play!' : 'pause!';

    // Update the Audio
    var method = pause ? 'pause' : 'play';
    yourAudio[method]();

    // Prevent Default Action
    return false;
};

Right now, the button is just simple text ("play!" or "pause!"), but you could do just about anything you wanted with CSS. Instead of setting the innerHTML, set the className and you're good to go!

Answer from sdleihssirhc on Stack Overflow
🌐
W3Schools
w3schools.com › html › html5_audio.asp
HTML Audio
To play an audio file in HTML, ... support the audio element. </audio> Try it Yourself » · The controls attribute adds audio controls, like play, pause, and volume....
🌐
W3Schools
w3schools.com › tags › att_audio_controls.asp
HTML audio controls Attribute
The controls attribute is a boolean attribute.When present, it specifies that audio controls should be displayed. ... The numbers in the table specify the first browser version that fully supports the attribute.
🌐
SitePoint
sitepoint.com › html & css
Styling Audio Control - HTML & CSS - SitePoint Forums | Web Development & Design Community
April 21, 2015 - I was able to use HTML5 to add a small audio clip to my client’s website. Woo hoo! Here is the code I added… <audio controls> <source src="/audio/wolf.ogg" type="audio/ogg" /> <source src="/audio/wolf.mp3" typ…
🌐
W3Schools
w3schools.com › tags › ref_av_dom.asp
HTML Audio/Video DOM Reference
The HTML5 DOM has methods, properties, and events for the <audio> and <video> elements.
🌐
GeeksforGeeks
geeksforgeeks.org › html › html5-audio-tag
HTML audio Tag %%page%% %%sep%% %%sitename%% - GeeksforGeeks
The 'controls' attribute provides buttons for managing audio, like play, pause, and volume adjustment. Any text contained between the <audio> tags is visible only on browsers that can't render the <audio> element.
Published   June 19, 2025
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › audio
<audio>: The Embed Audio element - HTML | MDN
The <audio> HTML element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.
Find elsewhere
🌐
Learncodepro
learncodepro.com › tutorials › mern stack web development › html › html — media: audio & video tags + controls
HTML — Media: Audio & Video tags + controls | LearnCodePro
September 14, 2025 - </audio> <!-- Audio with additional attributes --> <audio controls autoplay loop muted preload="auto"> <source src="audio/background-music.mp3" type="audio/mpeg"> <source src="audio/background-music.wav" type="audio/wav"> <p>Your browser doesn't support HTML5 audio.
Top answer
1 of 4
49

You create your elements like so...

<audio id="yourAudio" preload='none'>
    <source src='the url to the audio' type='audio/wav' />
</audio>
<a href="#" id="audioControl">play!</a>

And add some functionality:

var yourAudio = document.getElementById('yourAudio'),
    ctrl = document.getElementById('audioControl');

ctrl.onclick = function () {

    // Update the Button
    var pause = ctrl.innerHTML === 'pause!';
    ctrl.innerHTML = pause ? 'play!' : 'pause!';

    // Update the Audio
    var method = pause ? 'pause' : 'play';
    yourAudio[method]();

    // Prevent Default Action
    return false;
};

Right now, the button is just simple text ("play!" or "pause!"), but you could do just about anything you wanted with CSS. Instead of setting the innerHTML, set the className and you're good to go!

2 of 4
13

After a lot of research, I found an easy way of eliminating and manipulating specific parts of the predefined controls.

Create your elements as you usually would, like so:

<audio autoPlay>
    <source src='audioUrl' type='audio/mpeg' />
</audio>

Then in the CSS file, you write the following:

/* Specifies the size of the audio container */
audio {
  width: 115px;
  height: 25px;
}

audio::-webkit-media-controls-panel {
  -webkit-justify-content: center;
  height: 25px;
}

/* Removes the timeline */
audio::-webkit-media-controls-timeline {
  display: none !important;
}

/* Removes the time stamp */
audio::-webkit-media-controls-current-time-display {
  display: none;
}
audio::-webkit-media-controls-time-remaining-display {
  display: none;
}

With this code, you should get a small and nice looking container with only mute-button, pause/play-button and the 'download-file'-tag.

For an overview of all the things you can modify, have a look here.

The following code will also remove the mute- and the play-button:

/* Removes mute-button */
audio::-webkit-media-controls-mute-button {
  display: none;
}

/* Removes play-button */
audio::-webkit-media-controls-play-button {
  display: none;
}
🌐
Midas
midasconsoles.com › downloads.html
Midas | Downloads
Find and download product manuals and drivers for your Midas product here.
🌐
HTML Standard
html.spec.whatwg.org
HTML Standard
Rules for authors on how to use the element, along with user agent requirements for how to handle each element, are also given. This includes large signature features of HTML such as video playback and subtitles, form controls and form submission, and a 2D graphics API known as the HTML canvas.
🌐
Bose
bose.com › home › earbuds › bose ultra open earbuds
Shop Ultra Open Earbuds | Bluetooth Open Earbuds | Bose
January 25, 2026 - Up to 7 hours of play time (up to 4 hours with Immersive Audio or Auto Volume)¹ or up to 48 hours of standby,³ and up to an extra 19.5 hours of battery life in the charging case.⁴ ... Take personalization even further with Adjustable EQ settings in the Bose app. Control bass, mid-range, and treble levels as you go.
🌐
SamanthaMing
samanthaming.com › tidbits › 82-html-audio-tag
HTML <audio> Tag | SamanthaMing.com
<audio controls src="sound.ogg"> Your browser does not support the audio tag.
🌐
DotFactory
dofactory.com › html › audio
HTML audio Tag
The <audio> tag creates an audio player on a web page. It supports media controls, like play, pause, volume, and mute.
🌐
CatsWhoCode
catswhocode.com › development & programming › mastering the html tag
Mastering The HTML <audio> Tag
January 9, 2025 - The following example shows how you can build a rudimentary audio player with basic controls (Play, Pause, Volume Up, Volume Down) using HTML and JavaScript.
🌐
BitDegree
bitdegree.org › learn › html5-audio
HTML5 Audio: Explore HTML5 Audio Controls With Examples
February 26, 2019 - An uncontrollable HTML5 audio player means a terrible user experience. To provide your user with player buttons (also called the HTML5 audio controls), you need to include the controls attribute within the <audio> opening tag:
🌐
Mimo
mimo.org › glossary › html › audio-tag
HTML Audio Tag: Syntax, Usage, and Examples
The HTML audio tag allows you to embed and play audio files on a webpage. It provides built-in controls for play, pause, and volume adjustment, and supports various audio formats like MP3, WAV, and Ogg.
🌐
W3C
w3.org › TR › 2011 › WD-html5-author-20110809 › the-audio-element.html
4.8.7 The audio element — HTML5: Edition for Web Authors
controls · DOM interface: [NamedConstructor=Audio(), NamedConstructor=Audio(in DOMString src)] interface HTMLAudioElement : HTMLMediaElement {}; An audio element represents a sound or audio stream.
🌐
Spotify
developer.spotify.com › documentation › web-api
Web API | Spotify for Developers
Control and interact with the playback, play and resume, seek to a position or retrieve your queue.
🌐
UCI Music
music.arts.uci.edu › dobrian › webaudio › tutorials
Tutorials: HTML, JavaScript, and Web Audio
Control the depth of the vibrato, in cents, by adjusting its amplitude (controlled with a Gain node). ... Schedule sound events to take place at a specific time using the setInterval() global function. ... In the Web Audio API, a parameter of an audio node (an AudioParam) can be changed with sample-accurate timing. Use an HTMLMediaElement as an AudioNode in Web Audio