YouTip LogoYouTip

Prop Video Height

HTML DOM Video height Property

HTML DOM Video height Property

JavaScript Reference Manual

Overview

JavaScript Objects

JavaScript Array Object JavaScript Boolean Object JavaScript Date Object JavaScript Math Object JavaScript Number Object JavaScript String Object JavaScript RegExp Object JavaScript Global Properties/Functions JavaScript Operators JavaScript Error

Browser Objects

Window Object Navigator Object Screen Object History Object Location Object Storage Objects

DOM Objects

HTML DOM Document Object HTML DOM Element Objects HTML DOM Attribute Objects HTML DOM Event Objects HTML DOM Console Object CSSStyleDeclaration Object DOM HTMLCollection

HTML Objects

<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset> <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>

HTML DOM Track Object

HTML DOM Video loop Property

Deep Exploration

  • Script
  • Scripting Language
  • Computer Science
  • Web Service
  • Web Design and Development
  • Programming Languages
  • Programming
  • Software
  • Web Services
  • Development Tools

Video height Property

Video Object Reference Manual Video Object

Example

Change the height of the video:

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

Try it Β»


Definition and Usage

The height property sets or returns 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 both the height and width attributes for a video. If these attributes are set, space is reserved for the video while the page loads. If these attributes are not set, the browser does not know the size of the video, and cannot reserve the appropriate space for it. As a result, the page layout will change during page loading.

Note: Do not use the height and width attributes to scale the video! Use the height and width attributes to specify the dimensions of the video, or use CSS instead. Reducing the video dimensions using the height and width attributes forces the user to download the original full-size video (even though it may appear smaller on the page). The correct approach is to compress the video using software before publishing it on the web.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the height property.

Note: Internet Explorer 8 and earlier versions do not support the <video> element.


Syntax

Return the height property:

videoObject.height

Set the height property:

videoObject.height=pixels

Property Values

Value Description
pixels Specifies 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;

The result of x will be:

240

Try it Β»


Related Pages

HTML Reference: HTML <video> height Attribute


Video Object Reference Manual Video Object

← Jsref EveryJavascript Json Stringify β†’