HTML <video> widthProperty

HTML <video> Tag

Example

Video with specified height and width:

<video width="320" height="240" controls>
  <source src="movie.mp4.html" type="video/mp4">
  <source src="movie.ogg.html" type="video/ogg">
Your browser does not support the video tag.
</video>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the width attribute.

Note:Internet Explorer 8 and earlier IE versions do not support the <video> tag.


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 a video. If these attributes are set, space will be reserved for the video when the page loads. If these attributes are not set, the browser cannot determine the video's dimensions in advance, and therefore cannot reserve suitable space for it. As a result, the layout may shift during page loading.

Note:Do not use the height and width attributes to scale videos! Reducing a video with the height and width attributes only forces users to download the original video (even if it looks smaller on the page). The correct method is to compress the video with software before using it on a web page.


Differences between HTML 4.01 and HTML5

The <video> tag is a new tag in HTML5.


Syntax

<video width="pixels">

Property value

Value Description
pixels A width value in pixels (such as "100px" or 100).


HTML <video> Tagother extensions