Linking in SVG

You have seen some use of linking in SVG already. Let's take a moment to look in a little more detail at linking in SVG.

XLink in SVG

Linking in SVG is founded on the XML Linking Language, XLink, to which you were introduced in Chapter 13, “Linking Information: XLink, XBase, and XInclude.” In SVG, only simple XLink links are used.

The <a> Element

The <a> element in SVG differs from the <a> element in HTML or XHTML in the detail of how links are expressed. An <a> element in SVG uses an xlink:href attribute to contain the value of the linked Web page or other resource.

We can add a rollover button (like the one we started the chapter with) to an <a> element by nesting the SVG button within it. If we assign the value of "SimpleWebPage.svg" ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.