Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video height Property

Video height property

Video Object Reference The Video object

Example

Modify the height of the video:

document.getElementById("myVideo").height = "500";

Try it »


Definition and Usage

The height property is used to set or return the value of the height attribute.

The height property describes the height of the video, in pixels.

**Tip:** It is a good practice to specify the height and width of the video. If these attributes are set, space will be reserved for the video when the page loads. If they are not set, the browser cannot determine the dimensions of the video in advance, so it cannot reserve appropriate space for it. As a result, the layout may change during page loading.

**Note:** Do not use the height and width attributes to scale the video! Shrinking the video via the height and width attributes only forces the user to download the original video (even though it appears smaller on the page). The correct method is to compress the video with software before using it on the web page.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the height property

Note: Internet Explorer 8 and earlier IE versions do not support


Syntax

Return the height property:

videoObject

.height

Set the height property:

videoObject

.height=

pixels

Attribute values

Value Description
pixels Describes the height of the video, in pixels (e.g.: width="100")

Technical Details

Return Value: A number representing the height of the video, in pixels

More examples

Example

Get the height of the video:

var x = document.getElementById("myVideo").height;

x

The output is:

240

Try it »


Related pages

HTML Reference Manual: HTML


Video Object Reference The Video object