Javascript DOM HTML Video height Property set

Introduction

Change the height of a video:

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

Click the button to change the height of the video.

View in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="100" height="100" controls>
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>/* w ww. j a va 2  s  .  c o m*/
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
  document.getElementById("myVideo").height = "200";
}
</script>

</body>
</html>

The height property sets or gets the height attribute of a video.

The height attribute sets the height of a video in pixels.

Property Values

The height property returns a Number representing the height of the video in pixels.




PreviousNext

Related