SVGMarkerElement: markerWidth property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
ThemarkerWidth read-only property of theSVGMarkerElement interface returns anSVGAnimatedLength object containing the width of the<marker> viewport as defined by themarkerWidth attribute.
In this article
Value
AnSVGAnimatedLength object. ThebaseVal property of this object returns anSVGLength, the value of which returns thewidth.
Examples
ThemarkerWidth property returns anSVGAnimatedLength which contains anSVGLength with the value of themarkerWidth attribute.
html
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <defs> <marker viewBox="0 0 10 10" refX="5" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> </defs></svg>js
let marker = document.getElementById("arrow");console.log(marker.markerWidth.baseVal.value); // 6Specifications
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # __svg__SVGMarkerElement__markerWidth> |