Video height Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video

Description

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

Set the height property with the following Values

Value Description
pixels Sets the height of the video, in pixels (i.e. width="100")

Return Value

A Number, representing the height of the video, in pixels

The following code shows how to change the height of a video:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="320" height="240" controls>
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>/*from  w w w  .  j  a  v a 2  s  .  c o m*/

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

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

</body>
</html>

Related Tutorials