WebVTT
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
IndexSizeErrorDOMException- : Thrown when set to a value that is negative or greater than
100.
- : Thrown when set to a value that is negative or greater than
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.
const region = new VTTRegion();
region.width = 50; // Set the region to 50% of the video's width
console.log(region.width);
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
