W3cubDocs

/SVG

<a>

The <a> SVG element defines a hyperlink.

Since this element shares its tag name with HTML's <a> element, selecting "a" with CSS or querySelector may apply to the wrong kind of element. Try the @namespace rule to distinguish between the two.

Usage context

Attributes

Global attributes

Specific attributes

No browser supports all XLink attributes.

DOM Interface

This element implements the SVGAElement interface.

Example

SVG

<svg width="140" height="30" xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink">

  <a 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>

Result

Specifications

Browser compatibility

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

© 2005–2017 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/Element/a