Marker
The <marker> element defines the graphic that is to be used for drawing arrowheads or polymarkers on a given <path>, <line>, <polyline> or <polygon> element (MDN).
You attach markers to the shape using the marker-start, marker-mid, and marker-end attributes.
SVG attributes
marker-start
Defines the arrowhead or polymarker that will be drawn at the first vertex of the given shape.
marker-end
Defines the arrowhead or polymarker that will be drawn at the last vertex of the given shape.
marker-mid
Defines the arrowhead or polymarker that will be drawn at all interior vertices of the given shape.
| LIVE PREVIEW
SVG elements
<marker>
Defines a shape for drawing arrowheads or polymarkers.
markerWidth— width of the markermarkerHeight— height of the markermarkerUnits— defines the coordinate system formarkerWidth,markerHeight, and children of the<marker>; specifyuserSpaceOnUse(use absolute coordinate) orstrokeWidth(default)orient— defines the orientation of the marker relative to the shape it is attached to:auto: orient the marker such that its positive x-axis is pointing to the direction relative to the pathauto-start-reverse: likeauto, but if the marker is specified asmarker-start, then rotate it by 180° (makes the same marker points at opposite direction when specified asmarker-startandmarker-end)- an angle: e.g.
0(this is the default)
refX— defines the x coordinate for the reference point of the marker (think of it as an offset); specifyleft,center,right, or a coordinate/length (default is 0)refY— defines the y coordinate for the reference point of the marker (think of it as an offset); specifytop,center,bottom, or a coordinate/length (default is 0)viewBox— bounds of the SVG viewport, e.g.0 0 80 20(see View Box)preserveAspectRatio— defines how to fit the viewport if aspect ratio of theviewBoxdoes not match the givenmarkerWidthandmarkerHeight, e.g.xMidYMid meet(seepreserveAspectRatio)
| LIVE PREVIEW
References
- <marker> (MDN) — https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker
- orient (MDN) — https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/orient
- marker-mid (MDN) — https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/marker-mid