{
  "id": 22063810,
  "title": "Why Do SVG Dashes Shift When You Split a Path?",
  "url": "https://urgent.news/2026/11/26/why-do-svg-dashes-shift-when-you-split-a-path",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T22:46:31.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/axialisteam/why-do-svg-dashes-shift-when-you-split-a-path-4lpo"
  },
  "original_language": "en",
  "account": "When an SVG dashed outline is divided into two separate pieces, the dash pattern appears to shift on the second piece. This occurs because the dash starts anew at the beginning of each subpath after splitting. To maintain visual continuity, the second piece requires a modified dash offset. The provided SVG demonstrates three cases: an intact path, a split path with no offset, and a split path with a corrected offset. The intact path shows a dash from 80 to 104 units, while the split paths exhibit dashes from 80 to 110 units (offset 0) and from 80 to 104 units (offset +6). The corrected offset of +6 aligns the second dash seamlessly with the intact path. This shift results from the dash pattern repeating every 40 units, and the cut occurring at 6 units into the cycle. To correct the offset, the distance from the original start to the cut is added to the offset, and the result is wrapped around the pattern's period (40 units). For a dash array with an odd number of entries, SVG extends the list to form an even-length cycle before calculating the period. Adjusting the dash offset compensates for changes in the path length when using the pathLength attribute. By ensuring proportional values for the pieces and accounting for the cut position, the dash pattern remains consistent across the split SVG.",
  "summary": "You cut a dashed SVG outline into two pieces so you can style them separately. The pieces still meet at exactly the same point, but the dash over the cut gets longer. The next dash moves too. A dashed stroke starts its pattern at the beginning of each subpath. Splitting a path adds a new starting point, so the second piece needs its own dash offset to pick up where the first piece left off. One…",
  "key_points": [
    "SVG dashed outlines shift when path is split",
    "Dash pattern repeats every 40 units",
    "Correct offset compensates for cut position"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}