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
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> , <clipPath> , <color-profile> , <cursor> , <filter> , <font> , <font-face> , <foreignObject> , <image> , <marker> , <mask> , <pattern> , <script> , <style> , <switch> , <text> , <view> |
Attributes
Global attributes
- Conditional processing attributes
- Core attributes
- Graphical event attributes
- Presentation attributes
- Xlink attributes
class
style
externalResourcesRequired
transform
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
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 The definition of '<a>' in that specification. |
Candidate Recommendation | Replaced xlink:href attribute by href |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of '<a>' in that specification. |
Recommendation | Initial definition |
Browser compatibility
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.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1 | Yes | 1.5 | 9 | 9 | 3.1 |
download | ? | ? | ? | ? | ? | ? |
href | Yes | Yes | 51 | Yes | Yes | No |
hreflang | ? | ? | ? | ? | ? | ? |
rel | ? | ? | ? | ? | ? | ? |
target | 1 | Yes | 1.5 | 9 | 9 | 3.1 |
type | ? | ? | ? | ? | ? | ? |
xlink:actuate | ? | ? | ? | ? | ? | ? |
xlink:href | 1 | Yes | 1.5 | 9 | 9 | 3.1 |
xlink:show | ? | ? | ? | ? | ? | ? |
xlink:title | ? | ? | ? | ? | ? | ? |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | 3 | Yes | Yes | 4 | Yes | 3.1 | Yes |
download | ? | ? | ? | ? | ? | ? | ? |
href | ? | Yes | ? | 51 | ? | No | Yes |
hreflang | ? | ? | ? | ? | ? | ? | ? |
rel | ? | ? | ? | ? | ? | ? | ? |
target | 3 | Yes | Yes | 4 | Yes | 3.1 | Yes |
type | ? | ? | ? | ? | ? | ? | ? |
xlink:actuate | ? | ? | ? | ? | ? | ? | ? |
xlink:href | 3 | Yes | Yes | 4 | Yes | 3.1 | Yes |
xlink:show | ? | ? | ? | ? | ? | ? | ? |
xlink:title | ? | ? | ? | ? | ? | ? | ? |
Document Tags and Contributors
Tags:
Contributors to this page:
Jeremie,
keeprock,
Tigt,
abbycar,
Sebastianz,
teoli,
kscarfone,
ethertank,
Manuel_Strehl
Last updated by:
Jeremie,