Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <video> height 属性

❮ HTML <video> 标签

示例

带指定高度和宽度的视频播放器

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  您的浏览器不支持 video 标签。
</video>
自己尝试一下 »

定义和用法

The height 属性指定视频播放器的高度(以像素为单位)。

提示: 始终为视频指定 height width 属性。如果设置了这些属性,则在页面加载时会保留视频所需的空間。但是,如果没有这些属性,浏览器将不知道视频的大小,也无法为它保留合适的空間。效果是页面布局会在加载过程中发生变化(在视频加载时)。

注意: 不要使用 height width 属性来重新调整视频的大小!使用这些属性缩小大型视频会迫使用户下载原始视频(即使它在页面上看起来很小)。重新调整视频大小的正确方法是在将其用于网页之前使用程序进行重新调整。


浏览器支持

属性
height 4.0 9.0 3.5 3.1 11.5

语法

<video height="pixels">

属性值

描述
pixels 视频的高度,以像素为单位(即 height="100")

❮ HTML <video> 标签
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.