SVG is an XML vocabulary for two-dimensional graphics. Its elements fall into a handful of families — shapes, containers, paint servers, filters, text, and animation — and each renders or contributes to rendering in a specific way. This is a searchable offline reference.
How it works
Every element is tagged with the category it belongs to and a short description of what it does and the attributes you usually set:
- Shapes (
rect,circle,path) draw geometry;pathis the most general, using thedattribute’s command sequence. - Containers (
svg,g,defs,symbol) group and position other elements. Onlysvgandsymbolcreate a new viewport. - Paint servers (
linearGradient,radialGradient,pattern) define fills and strokes referenced viaurl(#id). - Filters (
filter,feGaussianBlur,feMerge) form a pipeline of primitives, each reading an input and producing an output. - Text (
text,tspan,textPath) lays out glyphs. - Animation (
animate,animateTransform,set) changes attributes over time (SMIL).
Example
A blurred drop shadow uses a filter pipeline:
<filter id="shadow">
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blur"/>
<feOffset in="blur" dx="2" dy="2" result="off"/>
<feMerge>
<feMergeNode in="off"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
Notes
- Reusable definitions (gradients, filters, symbols) go inside
defsand are referenced byidso they do not render on their own. - The
useelement clones a referenced element, letting you reuse shapes and symbols efficiently. - This reference covers the common elements, not the entire SVG 2 specification.