如何在 HTML 中新增背景音樂?


HTML <bgsound> 標籤用於在背景音樂中播放音樂。此標籤僅適用於 Internet Explorer。

示例

你可以嘗試執行以下程式碼在 HTML 中新增背景音樂 −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML bgsound Tag</title>
   </head>
   <body>
      <bgsound src = "/html/yourfile.mdi"/>
      <p>Plays sound file in the background.</p>
   </body>
</html>

HTML <bgsound> 標籤還支援以下屬性 −

屬性

說明
迴圈
數字
允許你一定的次數重新播放背景聲軌。
src
URL
指定聲音檔案路徑。




更新於: 24-6 月-2020

10K+ 瀏覽量

為你的職業做準備

透過完成課程獲得認證

開始
廣告