HTML DOM Video width attribute
Examples
Modify the width of the video player:
try it"
Definition and Usage
width property sets or returns the width of the video player.
width attribute describes the width of the video player in pixels.
Tip: predetermined width and height of the video is a good habit.If you set these properties, when the page loads will set aside space for the video. If you do not set these properties, the browser can not be pre-determined dimensions of the video, so you can not reserve a suitable space for the video. As a result, in the process of loading the page, its layout will change.
Note: Do not scale the video by height and width attributes!By height and width attributes to narrow the video will only force the user to download the original video (even though it looks small on the page). Before the correct approach is to use the video on the page, using the software for video compression.
Browser Support
All major browsers support width attribute.
Note: Internet Explorer 8 and earlier versions of IE do not support the <video> element.
grammar
Back width attributes:
Setting the width property:
Property Value
value | description |
---|---|
pixels | It describes a video player width in pixels (eg: width = "100") |
technical details
return value: | Number that video width in pixels. |
---|
More examples
Examples
Get width of the video:
x output values:
try it"
Related Pages
HTML Reference Manual: HTML <Video> width attribute
Video Object