Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom CSS for <audio> tag?

I'm building a music player web application which implements the HTML5 audio tag, however would like it to look consistent across browsers - is it possible to define my own custom CSS? And how?

like image 798
Fela Maslen Avatar asked Sep 25 '10 17:09

Fela Maslen


People also ask

How do you customize a sound tag in CSS?

Add the CSS Styles . audio-player { --player-button-width: 3em; --sound-button-width: 2em; --space: . 5em; ... } The --sound-button-width will be used for the width of the sound button, and --space will be used to add space between the track and the button.

How do I style an audio tag in HTML?

HTML 5 audio tags can be styled. By using the audio tag with “controls” attribute, the default browsers player is used. You can customize by not using the browsers controls. You can also add CSS classes to each one of the elements and style them accordingly.

How do you change the color of an audio tag in HTML?

Currently, you cannot change the color of the controls of the HTML5 audio tag. If you enable the controls attribute, the appearance of the 'play', 'pause', and 'volume' will be dependent on the browser.

How do I change the color of audio control in CSS?

CSS works on it. Try 'background-color'. It doesn't change the color entirely, but changes the color behind the grey control, so in the end, it looks like a darker version of whatever you choose. Also, try box shadow and border radius.


1 Answers

There is not currently any way to style HTML5 <audio> players using CSS. Instead, you can leave off the control attribute, and implement your own controls using Javascript. If you don't want to implement them all on your own, I'd recommend using an existing themeable HTML5 audio player, such as jPlayer.

like image 150
Brian Campbell Avatar answered Sep 18 '22 19:09

Brian Campbell