HTML <video>
width
Attribute
Example
A video with specified height and width:
Browser Support
All major browsers support the width
attribute.
Note: The <video>
tag is not supported in Internet Explorer 8 and earlier versions.
Definition and Usage
The width
attribute specifies the width of the video player.
Tip: It is a good practice to specify the height and width of the video. If these attributes are set, space is reserved on the page when the page is loaded. If these attributes are not set, the browser cannot know the size of the video in advance, and thus cannot reserve appropriate space for it. The result is that the layout of the page changes during the loading process.
Note: Do not scale the video via the height
and width
attributes! Scaling the video via these attributes only forces the user to download the original video (even if it appears smaller on the page). The correct method is to compress the video using software before using it on the web page.
Differences Between HTML 4.01 and HTML5
The <video>
tag is new in HTML5.
Syntax
Attribute Values
Value | Description |
---|---|
pixels | The width value in pixels (e.g., "100px" or 100). |