SVG marker-start, marker-mid, and marker-end Guide

In Scalable Vector Graphics (SVG), the marker-start, marker-mid, and marker-end attributes attach decorative symbols—such as arrowheads, circles, or custom shapes—to the vertices of graphical elements. This article provides a direct overview of how these attributes reference markers, which SVG elements support them, and the essential configuration parameters inside the referenced <marker> element that define positioning, orientation, and sizing.


The Marker Presentation Attributes

The marker-start, marker-mid, and marker-end attributes apply to path-based SVG elements: <path>, <line>, <polyline>, and <polygon>.

Accepted Attribute Values

Each of these three attributes accepts the following values:

  1. none (default): No marker is rendered at the specified vertex.
  2. url(#marker-id): A functional URL reference pointing to the unique id of a <marker> element defined within an SVG <defs> block.
  3. inherit: Inherits the marker assignment from the parent element.

Key Parameters of the <marker> Element

The attributes on the path simply point to a <marker> element; the actual behavior, dimension, and alignment are configured using the attributes of the <marker> tag itself.

1. refX and refY

2. markerWidth and markerHeight

3. markerUnits

4. orient

5. viewBox and preserveAspectRatio