在 HTML 中設定元素寬度


在 HTML 中使用 width 屬性設定元素的寬度。可以使用此屬性和以下元素:<canvas>、<embed>、<img>、<input>、<video> 等等。

示例

您可以嘗試執行以下程式碼以在 HTML 中實現width 屬性:-

 線上演示

<!DOCTYPE HTML>
<html>
   <body>

      <video width="300" height="200" controls autoplay>
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         Your browser does not support the video element.
      </video>

   </body>
</html>

輸出

更新於: 2020 年 6 月 24 日

232 次觀看

助力您的職業

完成課程取得認證

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