HTML.lt;video> width property

HTML video width attribute HTML and video. Tags

The width property is used to set the width of the video display area, as follows:

Video with specified height and width:

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

Try it out . . .

Browser support

HTML video width attribute HTML video width attribute HTML video width attribute HTML video width attribute HTML video width attribute

The width property is supported by all major browsers.

Note: Internet Explorer 8 and earlier versions of IE do not support the label.


Definitions and usages

The width property specifies the width of the video player.

Tip: It is a good habit to specify the height and width of the video. I f you set these properties, space is reserved for the video when the page loads. I f you don't set these properties, the browser can't pre-determine the size of the video, so it can't reserve the right space for the video. As a result, the layout of the page changes as it loads.

Note: Do not scale videos with the height and width properties! S hrinking the video with the height and width properties only forces the user to download the original video, even if it looks smaller on the page. The correct approach is to use software to compress the video before using it on a Web page.


The difference between HTML 4.01 and HTML5

The label is a new HTML5 label.


Grammar

<video width=" pixels ">

The property value

value describe
pixels A width value (such as "100px" or 100) with pixel gauge.


HTML video width attribute HTML and video. Tags