W3cubDocs

/SVG

xlink:href

Deprecated since SVG 2
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

« SVG Attribute reference home

The xlink:href attribute defines a link to a resource as a reference <IRI>. The exact meaning of that link depends on the context of each element using it. See above for more specific usage.

Note: SVG 2 removed the need for the xlink namespace, so instead of xlink:href you should use href.

Usage context

Elements

The following elements can use the xlink:href attribute

Animation elements »
An <IRI> reference to the element which is the target of this animation and which therefore will be modified over time. The target element must be part of the current SVG document. If the xlink:href attribute is not provided, then the target element will be the immediate parent element of the current animation element.
Gradient elements »
An <IRI> reference to a different <linearGradient> or <radialGradient> element within the current SVG document. Any <linearGradient> or <linearGradient> attributes which are defined on the referenced element which are not defined on this element are inherited by this element if this element is of the same type as the referenced element. If this element has no defined gradient stops, and the referenced element does (possibly due to its own xlink:href attribute), then this element inherits the gradient stop from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attribute or gradient stops due to its own xlink:href attribute, then the current element can inherit those attributes or gradient stops. On the gradient elements, the xlink:href attribute is animatable.
<a>
The location of the referenced object, expressed as an <IRI> reference. On the <a> element, the xlink:href attribute is animatable.
<altGlyph>
An <IRI> reference either to a <glyph> element in an SVG document or to an <altGlyphDef> element.

If the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the character(s) that are inside of the <altGlyph> element.

If the reference is to an <altGlyphDef> element, then if an appropriate set of alternate glyphs is located from processing the <altGlyphDef> element, then those alternate glyphs are rendered instead of the character(s) that are inside of the <altGlyph> element.
<color-profile>
The location of an ICC profile resource.
<cursor>
A <funcIRI> reference to the file or element which provides the image of the cursor. On the <cursor> element, the xlink:href attribute is animatable.
<feImage>
An <IRI> reference to the image source. On the <feImage> element, the xlink:href attribute is animatable.
<filter>
An <IRI> reference to another <filter> element within the current SVG document. Any attributes which are defined on the referenced <filter> element which are not defined on this element are inherited by this element. If this element has no defined filter nodes, and the referenced element has defined filter nodes (possibly due to its own xlink:href attribute), then this element inherits the filter nodes defined from the referenced <filter> element. Inheritance can be indirect to an arbitrary level; thus, if the referenced <filter> element inherits attributes or its filter node specification due to its own xlink:href attribute, then the current element can inherit those attributes or filter node specifications. On the <filter> element, the xlink:href attribute is animatable.
<font-face-uri>
The xlink:href attribute specifies the location of the referenced font.
<glyphRef>
An <IRI> reference to a <glyph> element in an SVG document. The referenced <glyph> is rendered as an alternate glyph.
<image>
An <IRI> reference to the image source. On the <image> element, the xlink:href attribute is animatable.
<mpath>
An <IRI> reference to the <path> element which defines the motion path.
<pattern>
An <IRI> reference to a different <pattern> element within the current SVG document. Any attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no children, and the referenced element does (possibly due to its own xlink:href attribute), then this element inherits the children from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attributes or children due to its own xlink:href attribute, then the current element can inherit those attributes or children. On the <pattern> element, the xlink:href attribute is animatable.
<script>
An <IRI> reference to an external resource containing the script code.
<textPath>
An <IRI> reference to the <path> element onto which the text will be rendered. On the <textPath> element, the xlink:href attribute is animatable.
<use>
An <IRI> reference to an element/fragment within an SVG document. On the <use> element, the xlink:href attribute is animatable.
<tref>
An <IRI> reference to an element whose character data content shall be used as character data for this <tref> element. On the <tref> element, the xlink:href attribute is animatable.

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href