HTML video Tag width Attribute Tutorial

In this section, we will learn what the width attribute is and how to use it.

What is width Attribute in HTML <video> Tag?

We use the width attribute when we want to set the width of the target video player.

It’s a good practice to always set the size of a video player (including its height) so that browsers know how much space that video player takes in a document.

The value we set for this attribute could be any number of HTML supported units.

HTML width Attribute in <video> Tag Syntax:

<video width = “number”> </video>

<video> Tag width Attribute Values

The value we set for the width attribute is numbers with HTML absolute or relative units.

Example: using width attribute in HTML <video> tag

See the Pen using width attribute in HTML <video> tag by Omid Dehghan (@odehghan) on CodePen.

Leave a Reply