Made with ♡ by
...you might notice funny hex colour names in the examples 😋
Scalable Vector Graphics
svg defines graphics on the web
describes 2D graphics in XML
W3C recommendation
defined by <svg> tag
<svg>
<!-- magic goes here -->
</svg>
and why not <img /> ?
space where svg content is created/drawn
infinite on x and y axis
BUT its size is relative to the viewport which if finite
(we only see viewport)
space where svg is visible
defined by width and height attr on the svg element
no unit means px
can accept other css units: em, ex, pt, cm, %...
page !== viewport
page can be wider/higher
svg attribute
defines new coord. system
values of viewBox are min-x min-y width height
effect is similar to cropping the graphic to that viewbox and then zooming in to the cropped area
min-x and min-y moves the coord. system, not the element
when min-x and min-y values are positive, they have the same effect like applying transform:translate(-x -y)
<use> element
href attribute points to the svg element that should be reused
x attribute sets the position on the x-axis of reused element
y attribute sets the position on the y-axis
default for x and y is 0
positioned at the top left corner of the original svg element
xlink:href => only for safari, deprecated
<symbol> reuses the whole svg and its attributes
a graphical template
initialised by the <use> element
href points to the id of symbol
xlink:href => only for safari, deprecated
you can find inspiration for light talk here: