When implementing an SVG sprite, an element is created and svg elements are referenced via the
element. The containing
Use <svg style="width:0; height:0;">
instead of <svg style="display: none;">
to hide the sprite.
<!-- SVG element -->
<svg id="svg-test" style="width:0; height:0;">
<clipPath id="my-clip-1">
<circle id="circle-1" cx="50" cy="50" r="50" />
</clipPath>
<path id="svg-test-reference" clip-path="url(#my-clip-1)" d="M10-39.288h80v80H10z" />
</svg>
<!-- Reference SVG <path> by ID with Use -->
<svg class="svg-item" viewBox="0 0 100 100">
<use xlink:href="#svg-test-reference" />
</svg>
Live example on Codepen.io
In my case, using only "width" and "height" equals to zero, left a void area where should be the image. However, using display:content;
instead display:none;
works fine, no void area and no image.