HTML <video> height attribute
Definition and usage
height
The attribute specifies the height of the video player in pixels.
Tip:Always specify the video's height
and width attribute. If these attributes are set, the space required for the video will be reserved when the page is loaded. However, if these attributes are not set, the browser does not know the size of the video and cannot reserve appropriate space for it. The result is that the page layout will change during loading (when the video is loading).
Note:Please do not use height
and width
Attribute to adjust the size of the video! Using these attributes to shrink large videos will force users to download the original video (even if it looks very small on the page). The correct method is to resize the video using a program before using it on a webpage.
Example
A video player with specified height and width has been set:
<video width="640" height="360" controls> <source src="shanghai.mp4" type="video/mp4"> <source src="shanghai.ogg" type="video/ogg"> Your browser does not support the video tag. </video>
Syntax
<video height="pixels">
Attribute Value
Value | Description |
---|---|
pixels | Video height in pixels (for example, height="100"). |
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.5 | 3.1 | 11.5 |