How to use CSS to Hide Controls In HTML
We can utilize CSS to hide the default audio controls by setting the display property to none for the audio element.
Syntax:
<style>
audio::-webkit-media-controls {
display: none;
}
</style>
Example: Illustration of hiding Audio controls in HTML5 using CSS to Hide Controls
HTML
<!DOCTYPE html> < html > < head > < title >Hide Audio Controls using CSS</ title > < style > audio::-webkit-media-controls { display: none; } </ style > </ head > < body > < h1 >Audio Player</ h1 > < audio src = "audio.mp3" controls> Your browser does not support the audio element. </ audio > </ body > </ html > |
Output:
How to Hide Audio Controls in HTML5 ?
In HTML5, the <audio> element embeds audio content into web pages. By default, it comes with built-in controls like play, pause, and volume adjustment. However, there might be scenarios where you want to hide these controls for a cleaner or more customized user experience. This article explores various approaches to achieve this in HTML5.
Table of Content
- Using the controls attribute
- Using CSS to Hide Controls
- Using JavaScript to Dynamically Hide Controls