Executive Summary: The W3C Scalable Vector Graphics (SVG) specification is composed of discrete XML elements that dictate layout, rendering, compositing, and interactivity. This glossary provides exhaustive technical definitions, specifications, and code patterns for 42 core SVG document elements grouped into 7 functional architectural domains:
- Structural Containers:
<svg>,<g>,<defs>,<symbol>,<use>, and<view>. - Shape Primitives:
<path>,<rect>,<circle>,<ellipse>,<line>,<polyline>, and<polygon>. - Embedded & Hybrid Content:
<foreignObject>and<image>. - Vector Typography:
<text>,<tspan>, and<textPath>. - Clipping, Masking & Markers:
<clipPath>,<mask>, and<marker>. - Paint Servers:
<linearGradient>,<radialGradient>,<stop>, and<pattern>. - Filter Shaders & Interactivity:
<filter>, filter primitives (<feGaussianBlur>,<feColorMatrix>,<feDropShadow>,<feMerge>), SMIL animations, and metadata nodes.
1. Structural & Container Elements
Container elements form the skeleton of an SVG document. They define coordinate spaces, establish grouping boundaries, and control element reuse.
width and height, the internal coordinate system via viewBox, and alignment modes via preserveAspectRatio. Can also be nested within an outer SVG to establish independent sub-viewports.<g> element—such as transform, fill, stroke, opacity, or CSS classes—cascade to all descendants unless explicitly overridden.<defs> (such as gradients, clip paths, filters, markers, or reusable shapes) is hidden until invoked by <use> or a url(#id) property.<g>, a <symbol> is never rendered on screen directly and possesses its own independent viewBox and preserveAspectRatio attributes, making it the foundational element for SVG icon sprite sheets.href="#targetId". The browser creates an internal Shadow DOM boundary that replicates the target geometry while allowing context-sensitive cascading of colors and coordinates (x, y, width, height).image.svg#viewId). Allows a single SVG asset to expose multiple targeted camera views or zoom states without duplicating markup.2. Basic Shape Primitives
These elements produce concrete vector shapes defined by mathematical geometric formulas.
d attribute: MoveTo (M), LineTo (L), Cubic Bézier (C, S), Quadratic Bézier (Q, T), Elliptical Arc (A), and ClosePath (Z).rx and vertical radius ry.cx, cy) and radial distance r.cx, cy) and independent horizontal (rx) and vertical (ry) semi-axes.x1, y1) to termination coordinates (x2, y2). Requires a visible stroke to be painted.x,y coordinate pairs. Unlike <polygon>, the terminal point does not automatically close back to the starting point.3. Embedded & Hybrid Content
Elements bridging vector geometry with external raster images and native HTML DOM layouts.
href. Supports preserveAspectRatio scaling modes.4. Vector Typography Elements
Elements dedicated to rendering selectable, searchable, and stylable typography inside vector viewports.
x and y coordinates. Supports font styling, alignment via text-anchor (start, middle, end), and vertical baseline alignment via dominant-baseline.<text> that allows inline adjustments to color, font weight, or coordinate offsets (dx, dy) without breaking the overall typographic flow.<path>. Glyph baselines rotate tangentially to match the curvature of the trajectory curve.5. Clipping, Masking & Marker Attachments
Elements controlling rendering visibility bounds, transparency stencils, and path vertex adornments.
clip-path="url(#id)" are only rendered where child shapes inside the clipPath exist. Anti-aliased outer edges are calculated geometrically without raster buffers.<path>, <line>, or <polyline> via marker-start, marker-mid, or marker-end.6. Paint Servers & Gradients
Elements providing procedural color ramps and repeating geometric patterns across fill and stroke channels.
x1, y1) and ending coordinates (x2, y2). Referenced via fill="url(#gradId)".fx, fy) to an outer boundary edge defined by center (cx, cy) and radius r.offset (0% to 100%), stop-color, and stop-opacity.patternUnits.7. Filter Shaders & Document Metadata
Elements providing GPU-accelerated graphics pipelines and accessible document metadata.
stdDeviation.aria-describedby.8. Frequently Asked Questions
What is the difference between <defs> and <symbol> in SVG?
<defs> is a general container that prevents any child elements from rendering directly on screen until referenced. <symbol> is a specialized container that not only prevents direct rendering but also establishes its own independent viewBox and aspect ratio settings, allowing cloned instances via <use> to scale independently.
How does the <use> tag clone elements across the SVG DOM tree?
The <use> tag references a target element by its URI or ID (e.g. href='#icon-search'). The browser clones the referenced node into a closed SVG Shadow DOM boundary attached to the <use> element. Properties like fill, stroke, and transformations can cascade from the <use> element into the cloned subtree.
What capabilities does <foreignObject> introduce to vector documents?
<foreignObject> acts as an architectural bridge between SVG and HTML/CSS. It allows developers to embed arbitrary HTML elements—such as responsive <div> layouts, complex CSS flexboxes, interactive buttons, form inputs, and styled typography—directly within an SVG coordinate system.
Why is <clipPath> faster for simple shape clipping compared to <mask>?
<clipPath> performs a binary 1-bit geometric scissor test: an interior pixel is either drawn or not drawn. <mask>, by contrast, performs a full 8-bit luminance or alpha raster calculation for every pixel, which requires more GPU memory bandwidth and compositing passes.
How do <title> and <desc> enhance SVG web accessibility (WCAG)?
When an <svg> element includes <title id='icon-title'> and <desc id='icon-desc'> connected via aria-labelledby='icon-title icon-desc', assistive technologies read the plain-text title as the element's accessible name and the description as its accessible context, fulfilling WCAG 2.2 accessibility standards.
How do SVG paint servers like <linearGradient> and <pattern> interact with shape fills?
Paint servers defined in <defs> (such as <linearGradient id='brandGrad'> or <pattern id='mesh'>) are referenced by presentation attributes or CSS via url(#brandGrad). The browser paints the calculated gradient ramp or repeating geometric tile across the target element's fill or stroke surface.