VTTRegion: width property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Want more support for this feature? Tell us why.

The width property of the VTTRegion interface represents the width of the region, as a percentage of the video's width.

Value

A number in the range 0 to 100 inclusive, representing the width of the region as a percentage of the video's width. The default is 100.

Exceptions

IndexSizeError DOMException

Thrown when set to a value that is negative or greater than 100.

Examples

In the following example, a new VTTRegion is created, then the value of width is set to 50. The value is then printed to the console.

js
const region = new VTTRegion();
region.width = 50; // Set the region to 50% of the video's width
console.log(region.width);

Specifications

Specification
WebVTT: The Web Video Text Tracks Format
# dom-vttregion-width

Browser compatibility