3

I want a single icon sound player which when a user click plays a sound file... The only requirement is that it should be pure HTML CSS only... No JavaScript please

<a href="test.mp3"><i class="fa fa-sound"></a>
MG425
  • 78
  • 1
  • 6

1 Answers1

3

It is possible but only using javascript. you can do it using following code:

    <audio id="player" src="Kalimba.mp3"></audio>
    <div>
         <a onclick="document.getElementById('player').play()"><i class='fa fa-volume-up fa-2x'></i></a>
     </div>

Good Luck!

Edit:

The href colour will make it blue. you need to add custom css rule to change it back to black. Google that.

For Example:

a {
    color: black;
    background-color: transparent;
    text-decoration: none;
 }
MMG
  • 390
  • 1
  • 6
  • 20