Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Video width Property
The HTML DOM Video width property returns/sets a number corresponding to width (in pixels) of media.
Syntax
Following is the syntax −
Returning width as a number (px)
mediaObject.width
Setting width to a number (px)
mediaObject.width = number
Let us see an example of Video width property −
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video width</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-width</legend>
<video id="demo" height="200" width="170" 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.width += 50;
divDisplay.textContent = 'Video width: '+demo.width;
}
</script>
</body>
</html>
Output
Before clicking ‘Video Not Visible’ button −

Clicking ‘Video Not Visible’ button 3 times −

Advertisements