HTML DOM Video height Property


The HTML DOM Video height property returns/sets a number corresponding to height (in pixels) of media.

Syntax

Following is the syntax −

Returning height as a number (px)

mediaObject.height

Setting height to a number (px)

mediaObject.height = number

Let us see an example of Video height property −

Example

Live Demo

<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video height</title>
<style>
   * {
      padding: 2px;
      margin:5px;
   }
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
   <form>
      <fieldset>
         <legend>HTML-DOM-Video-height</legend>
         <video id="demo" width="320" height="50" controls><source    src="http://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br>
         <input type="button" onclick="getTrackDetails()" value="Video Not Visible">
         <div id="divDisplay"></div>
      </fieldset>
   </form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var demo = document.getElementById("demo");
   function getTrackDetails() {
      demo.height += 50;
      divDisplay.textContent = 'Video height: '+demo.height;
   }
</script>
</body>
</html>

Output

Before clicking ‘Video Not Visible’ button −

Clicking ‘Video Not Visible’ button 3 times −

Updated on: 18-Feb-2021

64 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements