如何在 HTML 中設定在影片下載期間顯示的影像?


在本文中,我們將學習如何在 HTML 中設定在影片下載期間顯示的影像。

HTML 的`

語法

以下是 HTML `` 屬性的語法。

<video poster="URL">

讓我們深入研究以下示例,以便您可以更多地瞭解 HTML `` 屬性。

示例 1

在以下示例中,我們使用 `

<!DOCTYPE html>
<html>
<body>
   <center>
      <video width="340" height="220" controls poster="https://tutorialspoint.tw/static/images/logo-color.png">
      <source src="https://samplelib.com/lib/preview/mp4/sample-5s.mp4" type="video/mp4">
      </video>
   </center>
</body>
</html>

執行上述指令碼後,它將生成一個輸出,其中包含已上傳的影片以及使用 `

示例 2

考慮以下示例,其中我們使用兩個影片,一個帶有 `` 屬性。

<!DOCTYPE html>
<html>
<body>
   <center>
   <video width="340" height="220" controls poster="https://tutorialspoint.tw/images/logo.png">
      <source src="https://samplelib.com/lib/preview/mp4/sample-5s.mp4">
   </video>
   <video width="320" height="240" controls>
      <source src="https://samplelib.com/lib/preview/mp4/sample-30s.mp4">
   </video>
   </center>
</body>
</html>

指令碼執行後,它將生成一個輸出,其中包含上傳到網頁的兩個影片,其中一個添加了 HTML `` 屬性,另一個是普通的。

更新於:2022年12月15日

252 次瀏覽

啟動你的職業生涯

完成課程獲得認證

開始學習
廣告
© . All rights reserved.