English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The width attribute of the <video> element specifies the width of the video player in pixels. Always specify both the height and width attributes of the video. If both height and width are set, the space required by the video is reserved when the page is loaded.
with specified height380px and280px video:
<video width="380" height="280" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video>Test and see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the width attribute.
Note: Internet Explorer 8 and earlier IE versions do not support the <video> tag.
The width attribute specifies the width of the video player in pixels.
Tip: Always specify both the height and width attributes of the video at the same time. If both height and width are set, the space required by the video will be reserved when the page is loaded. However, if these attributes are not set, the browser will not know the size of the video and cannot reserve appropriate space for it. The result is that the page layout will change during loading (when the video is loading).
Note: Do not use the height and width attributes to resize videos! Using the height and width attributes to shrink the size of large videos will force users to download the original video (even if it looks small on the page). The correct way to resize videos is to use a program, then use it on the page.
The <video> tag is part of HTML5 New tag.
<video width="pixels">
Value | Description |
---|---|
pixels | Width value in pixels (for example "100px" or 100). |