# CSS to use wav files

**URL:** <https://forum.kirupa.com/t/css-to-use-wav-files/237904>\
**Category:** web dev\
**Created:** [September 5, 2007, 11:47am UTC](https://forum.kirupa.com/t/css-to-use-wav-files/237904 "2007-09-05T11:47:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![glidealong](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@glidealong](https://forum.kirupa.com/u/glidealong)\
**Post date:** [September 5, 2007, 11:47am UTC](https://forum.kirupa.com/t/css-to-use-wav-files/237904/1 "2007-09-05T11:47:10Z")

</div>

I had an interview last week and one of the questions asked was “Is it possible to play a sound using CSS?” .  
I replied in the negative since i had no prior knowledge about the same. On searching the net, i found that no one had a single working example and all the answers tend to be negative. But on querying w3c i found something called pseudo-elements [http://www.w3schools.com/css/css\_pseudo\_elements.asp](http://www.w3schools.com/css/css_pseudo_elements.asp)  
Below is the relevant section.  
**CSS2 - The :before Pseudo-element**

The “:before” pseudo-element can be used to insert some content before an element.  
The style below will play a sound before each occurrence of an \<h1\> element:  
h1:before  
{  
content: url(beep.wav)  
}

**CSS2 - The :after Pseudo-element**

## The “:after” pseudo-element can be used to insert some content after an element. The style below will play a sound after each occurrence of an \<h1\> element: h1:after { content: url(beep.wav) }

It works perfectly when i used a image file but not with a sound file.

Anybody got some clue???

Thanks to all…
