使用タグ使用時にSVGが正しく表示されません。 use tagを使わずに同じSVGタグで試してみましたが、今回は運が良かったし、正しく動作します。USGタグ使用時にSVGが正しく表示されない
残念ながら、SVGを適切に表示するにはUSEタグが必要です。私は何が間違っているのか分からない。私はツールを使って、このSVGコードをレンダリングしている
<!-- SVG which i'm tring to reuse using use tag--->
<svg xmlns="http://www.w3.org/2000/svg" height="17" width="17" style="display:none">
<symbol id="check">
<defs>
<rect id="addColumn_a" width="16" height="16" y=".996" rx="1"/>
<mask id="addColumn_b" width="16" height="16" x="0" y="0" fill="white">
<use xlink:href="#addColumn_a"/>
</mask>
</defs>
<g fill="none" fill-rule="evenodd" transform="translate(0 -.996)">
<rect width="16" height="1" y="6" fill="#404040"/>
<rect width="16" height="1" y="11" fill="#404040"/>
<rect width="15" height="1" x="3.028" y="8.565" fill="#404040" transform="rotate(-90 10.528 9.065)"/>
<rect width="15.348" height="1" x="-2.141" y="8.554" fill="#5C5C5C" transform="rotate(-90 5.533 9.054)"/>
<use stroke="#404040" stroke-width="2" mask="url(#addColumn_b)" xlink:href="#addColumn_a"/>
<rect width="16" height="6" x="-5" y="5.996" fill="#19AF5C" opacity=".651" transform="rotate(-90 3 8.996)" rx="1"/>
</g>
</symbol>
</svg>
<!-- USE Link refernce which is not rendering SVG properly--->
<svg height="17" width="17">
<use xlink:href="#check"></use>
</svg>
<!-- Same SVG tag just a small change removed symbol tag--->
<svg height="17" width="17">
<defs>
<rect id="a" width="16" height="16" y=".996" rx="1"/>
<mask id="b" width="16" height="16" x="0" y="0" fill="white">
<use xlink:href="#a"/>
</mask>
</defs>
<g fill="none" fill-rule="evenodd" transform="translate(0 -.996)">
<rect width="16" height="1" y="6" fill="#404040"/>
<rect width="16" height="1" y="11" fill="#404040"/>
<rect width="15" height="1" x="3.028" y="8.565" fill="#404040" transform="rotate(-90 10.528 9.065)"/>
<rect width="15.348" height="1" x="-2.141" y="8.554" fill="#5C5C5C" transform="rotate(-90 5.533 9.054)"/>
<use stroke="#404040" stroke-width="2" mask="url(#b)" xlink:href="#a"/>
<rect width="16" height="6" x="-5" y="5.996" fill="#19AF5C" opacity=".651" transform="rotate(-90 3 8.996)" rx="1"/>
</g>
</svg>
P.S、イラストレーターで作成したSVGのように見えない手書かれたコード
を、あなたは何を意味するのですか?あなたは外側の周りの太い線を指していますか? –
Firefoxは少なくともの要素をの要素内でサポートしていません。 を要素の外に移動して修正します。 –