--- title: slug: Web/SVG/Element/a tags: - Element SVG - SVG - SVG link translation_of: Web/SVG/Element/a ---
{{SVGRef}}

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

{{svginfo}}

Atrybuty

Atrybuty globalne

Atrybuty specyficzne

No browser supports all XLink attributes.

DOM model

Element implementuje {{domxref("SVGAElement")}}.

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

{{EmbedLiveSample("Example", 170, 60)}}

Specyfikacja

Specification Status Comment
{{SpecName("SVG2", "linking.html#Links", "<a>")}} {{Spec2("SVG2")}} Replaced {{SVGAttr("xlink:href")}} attribute by {{SVGAttr("href")}}
{{SpecName("SVG1.1", "linking.html#Links", "<a>")}} {{Spec2("SVG1.1")}} Initial definition

Wsparcie przeglądarek

{{CompatibilityTable}}

Feature Chrome Edge Firefox (Gecko) IE Opera Safari
Basic support 1.0 {{CompatVersionUnknown}} {{CompatGeckoDesktop('1.8')}} {{CompatIE('9.0')}} {{CompatOpera('9.0')}} {{CompatSafari('3.0.4')}}
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatAndroid('3.0')}} {{CompatVersionUnknown}} {{CompatGeckoMobile('1.8')}} {{CompatNo}} {{CompatVersionUnknown}} {{CompatSafari('3.0.4')}}