HTML <video> width Attribute
Last Updated :
12 Mar, 2024
HTML <video> width Attribute is used to specify the width of the video display area in pixels of its container element’s width.
Note: Always specify the width and the height of the video else the web page will be confused about how much space that video will require due to that reason web page slows down.
Syntax:Â
<video width="pixels">
Attribute Values:
Name
| Description
|
---|
pixels
| It specifies the width of the video player in terms of pixels.
|
Note: Downsizing a large-size video with the height and width attributes forces users to download the original video. The best way to rescale videos is with a program, before using it on a page.
HTML <video> width Attribute Examples
Example:Â In this example the video with a width attribute set to 400 pixels and a height attribute set to 240 pixels, displaying a video player with controls for the file “gfg.mp4” on GeeksforGeeks.
html<!DOCTYPE html>
<html>
<body>
<h3>
HTML Video width Attribute
</h3>
<br>
<video id="Test_Video" width="400" height="240" controls>
<source src="gfg.mp4" type="video/mp4">
</video>
</body>
</html>
Output:
HTML video Width Attribute
Supported Browsers: The browser supported by HTML video width Attribute are listed below:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...