<a>
Element <a>
SVG określa hiperłącze.
Element <a> HTML jest interpretowany tak samo jak element <a> SVG. Z tego względu w przypadku użycia selektora <a> w CSS lub JavaScript może mieć zastosowanie do nieprawidłowego elementu. Wypróbuj regułę @namespace, aby rozróżnić między nimi.
Użycie
Categories | Container element |
---|---|
Permitted content | Any number of the following elements, in any order: Animation elements Descriptive elements Shape elements Structural elements Gradient elements <a> , <altGlyphDef> (en-US), <clipPath> (en-US), <color-profile> , <cursor> (en-US), <filter> (en-US), <font> (en-US), <font-face> (en-US), <foreignObject> (en-US), <image> (en-US), <marker> (en-US), <mask> (en-US), <pattern> (en-US), <script> (en-US), <style> (en-US), <switch> (en-US), <text> (en-US), <view> (en-US) |
Atrybuty
Atrybuty globalne
Atrybuty specyficzne
No browser supports all XLink attributes.
DOM model
Element implementuje SVGAElement
(en-US).
Przykład
SVG
<svg width="140" height="30" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<a xlink:href="https://developer.mozilla.org/en-US/docs/SVG"
target="_blank">
<rect height="30" width="120" y="0" x="0" rx="15"/>
<text fill="white" text-anchor="middle"
y="21" x="60">SVG on MDN</text>
</a>
</svg>
Rezultat
Specyfikacja
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 The definition of '<a>' in that specification. |
Candidate Recommendation | Replaced xlink:href (en-US) attribute by href (en-US) |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of '<a>' in that specification. |
Recommendation | Initial definition |
Wsparcie przeglądarek
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Feature | Chrome | Edge | Firefox (Gecko) | IE | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.5 (1.8) | 9.0 | 9.0 | 3.0.4 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 3.0 | (Yes) | 1.0 (1.8) | No support | (Yes) | 3.0.4 |