SVG in SVG

SVG's image element can also reference external SVG files. This support is added to allow SVG files to incorporate other SVG files just as they would another graphic. In the same manner that an SVG document can render with a JPEG file inside, so too can it render an SVG document inside an SVG document.

There is no change in syntax for the image element to support SVG inclusion. Rather, the xlink:href value should point to an SVG document instead of a JPEG or PNG file. The x, y, width, and height attributes still accept the same values and operate in the same manner.

So what is the value of placing an SVG file within an SVG file? This question has many possible answers. By allowing developers to link and render outside SVG files, multiple ...

Get Sams Teach Yourself SVG in 24 Hours 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.