在SVG中嵌入SVG? [英] Embed SVG in SVG?

查看:195
本文介绍了在SVG中嵌入SVG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SVG文档,我想在其中包含一个外部svg图像,例如:

I have an SVG document, and I would like to include an external svg image within it, i.e. something like:

<object data="logo.svgz" width="100" height="100" x="200" y="400"/>

(对象"只是一个例子-外部文档将是SVG而不是xhtml).

("object" is just an example - the outer document will be SVG rather than xhtml).

有什么想法吗?这有可能吗?还是对我来说,最好只是将logo.svg xml拍打到我的外部SVG文档中?

Any ideas? Is this even possible? Or is the best thing for me to simply slap the logo.svg xml into my outer SVG document?

推荐答案

使用 image 元素并引用您的SVG文件.为了娱乐,请将以下内容另存为recursion.svg:

<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <circle cx="-50" cy="-50" r="30" style="fill:red" />
  <image x="10" y="20" width="80" height="80" xlink:href="recursion.svg" />
</svg>

这篇关于在SVG中嵌入SVG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆