为什么没有显示此SVG?

时间:2020-05-28 08:43:25

标签: html svg

我正在使用SVG的项目中。我通过ocaml库生成了svg代码:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:l="http://www.w3.org/1999/xlink" version="1.1" width="161.8mm" height="100mm" viewBox="0 0 161.8 100" color-profile="auto" color-interpolation="linearRGB" color-interpolation-filters="linearRGB">
  <g fill="none" stroke-miterlimit="9.98123" transform="matrix(100 0 0 -100 -0 100)">
    <defs>
      <path id="i1" d="M0 0L1.618 0L1.618 1L0 1Z"/>
    </defs>
    <use l:href="#i1" fill="#50C878"/>
  </g>
</svg>

当我使用 gthumb GIMP 显示svg时,它会打印正确的绿色方块。但是,当我将此代码块包含在 Chromium Firefox 中时,该代码块出现在html树中,但未显示任何内容。这是我第一次使用svg:经过Google的多项研究后,我什么都找不到....

有人知道为什么它不起作用吗?

编辑

解决答案:

<use xlink:href="#i1">

0 个答案:

没有答案