Vector graphics
Geometric commands (curves, lines, etc) rather than an aray of pixel values
Inherently scalable for different viewing sizes
Geometric commands (curves, lines, etc) rather than an aray of pixel values
Inherently scalable for different viewing sizes
<svg viewBox="0 0 500 300">
Your graphics go here
</svg>
rect
element.
The attributes x
and y
control the coordinates of its top left corner,
and width
and height
control its dimensions.circle
element.
The attributes cx
and cy
control the centerpoint placement and r
controls the radius.0
, it can be omitted.use
element allows us to re-use SVG markup, even across documents!use
xlink:href
instead of href
.
You will also need to add xmlns:xlink="http://www.w3.org/1999/xlink"
to your root svg
element.L
path command. Its two arguments are the endpoint coordinates.l
for endpoint coordinates that are relative to the starting point.line
elementH
and V
path commands to create horizontal and vertical lines.h
and v
for endpoint coordinates that are relative to the starting point.C
path command to create cubic beziers.Q
path command to create quadratic beziersA
/a
path commands create circular or elliptical arcs.stroke-dasharray
can be animated with CSS animations!