我正在尝试在 svg 图像周围添加边框。我尝试了两种方法,但都失败了......
尝试1:绘制图像但没有边框..
<image id="note-0" xlink:href="http://example.com/example.png" x="185" y="79" height="202" width="150" style="stroke:#ac0d0d; stroke-width:3;"></image>
尝试2:绘制图像但没有边框..
<defs>
<image id="image1352022098990svg" height="202" width="150" xlink:href="http://example.com/example.png"></image>
</defs>
<use xmlns="http://www.w3.org/2000/svg" id="note-0" xlink:href="#image1352022098990svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="185" y="79" height="202" width="150" style="stroke:#ac0d0d; stroke-width:3;"/>
所以我的问题是,是否可以在 svg 元素上定义图像并同时在其周围设置边框/描边?
此外,我似乎可以使用 translate 和 x/y 属性来定位 svg 元素。哪个是首选,为什么?