Das href-Attribut definiert einen Link zu einer Ressource als Referenz-URL. Die genaue Bedeutung dieses Links hängt vom Kontext des jeweiligen Elements ab, das es verwendet.
Hinweis:
Spezifikationen vor SVG 2 definierten ein xlink:href-Attribut, das durch das href-Attribut nun obsolet geworden ist. Wenn Sie ältere Browserversionen unterstützen müssen, kann das veraltete xlink:href-Attribut als Fallback zusätzlich zum href-Attribut genutzt werden, z. B. <use href="some-id" xlink:href="some-id" x="5" y="5" />.
Sie können dieses Attribut mit folgenden SVG-Elementen verwenden:
Für <animate>, <animateMotion>, <animateTransform> und <set> definiert href eine URL, die auf das Element verweist, das Ziel dieses Animationselements ist und daher im Laufe der Zeit modifiziert wird.
Die URL muss genau auf ein Ziel-Element zeigen, das als Ziel des gegebenen Animationselements geeignet ist. Zeigt die URL auf mehrere Ziel-Elemente, wenn das angegebene Ziel-Element nicht als Ziel für das gegebene Animationselement geeignet ist oder wenn das Ziel-Element nicht Teil des aktuellen Dokuments ist, wird das Animationselement kein Ziel-Element beeinflussen. Dennoch wird das Animationselement weiterhin normal in Bezug auf seine Zeitsteuerungseigenschaften funktionieren. Insbesondere werden TimeEvents gesendet und das Animationselement kann wie gewohnt als Synchronisationsbasis verwendet werden, als ob die URL auf ein gültiges Ziel-Element verweist.
Wenn das href-Attribut oder das veraltete xlink:href-Attribut nicht angegeben ist, wird das unmittelbare übergeordnete Element des aktuellen Animationselements das Ziel-Element sein. Wenn sowohl xlink:href als auch href angegeben werden, wird der Wert des letzteren Attributs verwendet.
Beziehen Sie sich auf die Beschreibungen der einzelnen Animationselemente für Einschränkungen hinsichtlich der Typen von Elementen, die Ziele bestimmter Animationstypen sein können.
Abgesehen von den ausdrücklich in dieser Spezifikation genannten SVG-spezifischen Regeln erfolgt die normative Definition für dieses Attribut in der SMIL-Animationsspezifikation. Siehe insbesondere SMIL Animation: Specifying the animation target.
Für <feImage> definiert href eine URL, die auf eine Bildressource oder ein Element verweist. Wenn sowohl xlink:href als auch das href-Attribut angegeben werden, überschreibt letzteres das erstere.
Für <linearGradient> oder <radialGradient> definiert href eine URL, die auf ein Vorlage-Gradienten-Element verweist; um gültig zu sein, muss der Verweis auf ein anderes <linearGradient>- oder <radialGradient>-Element zeigen.
Für <pattern> definiert href eine URL, die auf ein anderes <pattern>-Element innerhalb des aktuellen SVG-Dokuments verweist. Alle Attribute, die auf dem referenzierten Element definiert sind, aber nicht auf diesem Element, werden von diesem Element geerbt. Falls dieses Element keine Kinder hat, das referenzierte Element jedoch schon (möglicherweise aufgrund seines eigenen href-Attributs), dann erbt dieses Element die Kinder des referenzierten Elements. Die Vererbung kann indirekt bis zu einer beliebigen Ebene erfolgen; wenn das referenzierte Element Attribute oder Kinder aufgrund seines eigenen href-Attributs erbt, kann das aktuelle Element diese Attribute oder Kinder ebenfalls erben. Auf dem <pattern>-Element ist das href-Attribut animierbar.
Für <textPath> definiert href eine URL, die auf das <path>-Element oder die Grundform verweist, auf der der Text gerendert wird, wenn kein path-Attribut angegeben ist. Auf dem <textPath>-Element ist das href-Attribut animierbar.
Für <use> definiert href eine URL, die auf ein Element oder Fragment innerhalb eines SVG-Dokuments verweist, das geklont werden soll.
Das <use>-Element kann auf ein gesamtes SVG-Dokument verweisen, indem ein href-Wert ohne Fragment angegeben wird. Solche Verweise gelten als Verweise auf das Wurzelelement des referenzierten Dokuments.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.