SVGRect: width property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

The width property of the SVGRect interface is an alias for the DOMRect.width property. It describes the horizontal size of the element. It reflects the SVG element's width attribute and the CSS width property.

The width is a length; it is the distance from the left of element to the right of the element in the the user coordinate system. Its syntax is the same as that for <length>.

Usage context

Name width
Value <length> | <percentage>
Initial 0
Applies to <mask>, <svg>, <rect>, <image>, <foreignObject>
Inherited no
Percentages refer to the size of the SVG viewport
Media visual
Computed value absolute length or percentage
Animatable yes

Specifications

No specification found

No specification data found for api.SVGRect.width.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

BCD tables only load in the browser

See also