CSS 播放期间-属性

原文:https://www.geeksforgeeks.org/css-play-during-property/

CSS play-during 属性用于操纵任何网站后台的播放音频。添加讲座或演讲时,它也可以用作背景音。

语法:

play-during: <uri> 

属性值:该属性接受如上所述的单个参数,如下所述:

  • URL: This attribute value holds the source of the audio tune to be used as the background tune. There are four possible values to operate audio tuning, mixing, repetition, automatic and none.
  • Mixing: This attribute value holds the background sound of the element to be played and any background sound generated by the playing period value of any ancestor element.
  • Repeat: If the background sound ends before the element is fully rendered, the attribute value holds the background sound to be repeated.
  • auto: This attribute value describes the sound that any ancestor element is playing.
  • None: This attribute value describes the complete background silence during element rendering.

示例 1: 在本例中,背景曲调将播放一次。

HTML

<!DOCTYPE html>
<html>

<head>
    <style>
        audio {
            play-during: url("flute.wav") none;
        }
    </style>
</head>

<body style="text-align: center;">
    <h1 style="color: green;">GeeksforGeeks</h1>

    <p>CSS play-during Property</p>

    <audio controls>
        <source src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190625153922/frog.mp3"
            type="audio/mp3">
    </audio>
</body>

</html>