CSS play-during property
CSS play-during Property
Description
The play-during property defines a sound that plays while the element’s content is being rendered. This sound is also known as a “background sound.”
Possible Values
- uri − A single URI may be given, and it should resolve to a sound file. If it does not resolve, play-during is assumed to be set automatically.
-
mix − Causes the element’s background sound to play along with any background sounds generated by the play-during value of any ancestor element.
-
repeat − If the background sound finishes before the element is fully rendered, the background sound will play repeatedly. If the value doesn’t include repeat, the sound will play only once.
-
auto − Any sounds currently playing for any ancestor elements will still be heard, but the current element will not produce any background sounds.
-
none − Causes complete silence during element rendering. The element does not play background sounds, and any background sounds associated with ancestor elements are also muted.
DOM Syntax
object.style.playDuring = "mix";
Applies to
All HTML elements
Example
This is an example-
<style type = "text/css">
<!--
h1 {play-during: url(ocean-waves.wav) mix repeat;}
a:link {play-during: none;}
-->
</style>