Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
<a>

The <a> element creates a hyperlink around its child content.

It is a transparent grouping container: it draws nothing of its own and does not establish a new coordinate system, but its children render in-place exactly as if the <a> were not there.

Unlike <g>, <a> is allowed both inside and outside of text content. When it appears inside a <text> (or <tspan>) flow it behaves like a <tspan> - a text-content group whose text children participate in the surrounding text layout, and which supports the per-glyph positioning attributes x, y, dx, dy, and rotate. When it appears outside of text it behaves like a <g>, grouping arbitrary graphics elements.

The link target is given by href (or the legacy xlink:href). An embedding application can call DonnerController::hitTestLink to map a pointer position to the enclosing link, then decide whether and how to navigate; Donner returns the authored target and never navigates on its own. Hit testing operates at text-element granularity, so an <a> wrapping a whole <text> is detected, while an inline <a> nested inside <text> is not returned as a separate inline link.

Attributes

Attribute Default Description
href (none) Link target retained on the DOM element. xlink:href is accepted as an alias.
x (none) Absolute X position(s) in text layout; if omitted, the surrounding text position continues.
y (none) Absolute Y position(s) in text layout; if omitted, the surrounding text position continues.
dx (none) Relative X shift(s) for linked text glyphs.
dy (none) Relative Y shift(s) for linked text glyphs.
rotate (none) Rotation values for linked text glyphs, in degrees.
textLength (none) Author-specified total advance length for linked text.
lengthAdjust spacing spacing or spacingAndGlyphs adjustment mode.
<text x="20" y="40">
<a href="https://www.w3.org/TR/SVG2/">SVG 2</a>
</text>