在 HTML 中设置元素的宽度

htmlweb developmentfront end technology更新于 2024/8/14 22:36:17

在 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>

输出


相关文章


有用资源