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

查看:85
本文介绍了在 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">
  <circle cx="-50" cy="-50" r="30" style="fill:red" />
  <image x="10" y="20" width="80" height="80" href="recursion.svg" />
</svg>

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

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