我有一个带有<symbol>trhat的 svg 精灵,其中包含一个<linearGradient>. 我在提出<g>这个相同的<symbol>这一梯度的fill="url(#id)"。但是,当我在其他文档中加载<symbol>with<use>时,<linearGradient>不会加载。我可以看到填充的 url 指的是绝对路径而不是文档内部,并且没有正确加载。
如何<linearGradient>在 a 中加载a <symbol>?
<symbol viewBox="0 0 550 90" width="100%" height="100%">
<defs>
<linearGradient id="gradient">
<stop offset="-1.04974" stop-color="#D8D8D8">
<animate attributeName="offset" values="-2; 1" dur="1s" repeatCount="indefinite"></animate>
</stop>
<stop offset="-0.549739" stop-color="#EEEEEE">
<animate attributeName="offset" values="-1.5; 1.5" dur="1s" repeatCount="indefinite"></animate>
</stop>
<stop offset="-0.0497395" stop-color="#D8D8D8">
<animate attributeName="offset" values="-1; 2" dur="1s" repeatCount="indefinite"></animate>
</stop>
</linearGradient>
</defs>
<g fill="url(#gradient)">
<rect x="0" y="0" width="100" height="15"/>
<rect x="10" …Run Code Online (Sandbox Code Playgroud)