Video height
Property
Example
Modify the height of the video:
document.getElementById("myVideo").height = "500";
Definition and Usage
The height property is used to set or return the value of the height attribute.
The height attribute describes the height of the video, measured in pixels.
Tip: It is a good practice to specify the height and width of the video. If these properties are set, space is reserved for the video when the page loads. If these properties are not set, the browser cannot pre-determine the video's size, which means it cannot reserve appropriate space for the video. The result is that the page layout may change during the loading process.
Note: Do not scale the video using the height and width properties! Shrinking the video using the height and width properties will only force the user to download the original video (even if it appears smaller on the page). The correct method is to compress the video using software before using it on the web page.
Browser Support
All major browsers support the height property.
Note: The <video> element is not supported in Internet Explorer 8 and earlier versions.
Syntax
Return the height property:
Set the height property:
Property Values
Value | Description |
---|---|
pixels | Describes the height of the video, measured in pixels (e.g., width="100") |
Technical Details
| Return Value: | Number, representing the height of the video, measured in pixels | | --- | --- |
More Examples
Example
Get the height of the video:
var x = document.getElementById("myVideo").height;
240
Related Pages
HTML Reference: HTML <video> height Attribute