SVGVectorDesign

SVG Path CommandsMove, Horizontal, Vertical, Line, Close

M means Move, and indicates the point where we will start drawing. Currently, the Move value is set to 150, 150. The first number indicates the x-axis, and the second number indicates the y-axis. You can play around with the values to see the changes.

M
Code
<svg viewbox="0 0 300 300">
  <path d="M 150,150" />
</svg>
Preview

H means Horizontal and it draws a horizontal line to the x-coordinate given as 200. In the following example, observe the changes by moving the points around.

M
H
Code
<svg viewbox="0 0 300 300">
  <path d="M 100,150 H 200" />
</svg>
Preview

V means Vertical and it draws a vertical line to the y-coordinate given as 200. In the following example, observe the changes by moving the points around.

M
V
Code
<svg viewbox="0 0 300 300">
  <path d="M 150,100 V 200" />
</svg>
Preview

L means Line, and it draws a line from our current position to the specified position. Currently, the Line value is set to 150, 200. Also, our new pointer will be at the end of the line. The first number indicates the x-axis, and the second number indicates the y-axis. You can play around with the values to see the changes.

M
L
Code
<svg viewbox="0 0 300 300">
  <path d="M 100,100 L 150,200" />
</svg>
Preview

Since our last command was L, we can continue drawing lines by entering the new coordinates without entering the command again. The next point that our line will go to will be 200, 100.

M
L1
L2
Code
<svg viewbox="0 0 300 300">
  <path d="M 100,100 L 150,200 200,100" />
</svg>
Preview

Z is a command that we use to draw a line back to the starting point of the path that we have drawn. It can be called Close Path.

M
L1
L2
Code
<svg viewbox="0 0 300 300">
  <path d="M 100,100 L 150,200 200,100 Z" />
</svg>
Preview


If this content helped you, you can buy me a coffee.
Related: Perfect Nested Rounded Corners

You can join the newsletter to be notified of awesome interactive articles and courses about software, design and AI. You will receive at most a few emails per month.


+80

Join to our Supporters or Sponsors