-2

我试图在 svg 位置插入带有文本的图像链接

这是我的代码

<svg width="100" height="100">
 <circle cx="20" cy="20" r="20" fill="green" />
       <circle cx="70" cy="70" r="20" fill="purple" />
  <text x="20" y="20" font-family="sans-serif" font-size="20px"     
  fill="red">Hello!</text>
<image      xlink:href="https://s-media-cache-ak0.pinimg.com/736x/76/47/9d/76479dd91dc55c2768ddccfc30a4fbf5--pikachu-halloween-costume-diy-halloween-costumes.jpg"        />
   </svg>

我怎么能做到这一点

请帮我

4

1 回答 1

0

SVG 中的图像 ( <image>) 需要有widthheight指定。如果您不提供宽度和高度,它们默认为 0,这意味着图像将不可见。

<svg width="100" height="100">
 <circle cx="20" cy="20" r="20" fill="green" />
       <circle cx="70" cy="70" r="20" fill="purple" />
  <text x="20" y="20" font-family="sans-serif" font-size="20px"     
  fill="red">Hello!</text>
  <image xlink:href="https://s-media-cache-ak0.pinimg.com/736x/76/47/9d/76479dd91dc55c2768ddccfc30a4fbf5--pikachu-halloween-costume-diy-halloween-costumes.jpg"
         x="10" y="50" width="37" height="37"/>
</svg>

于 2017-06-26T09:13:27.790 回答