Recently, I made the decision to switch to using SVG symbols for one of my projects. However, I encountered a challenge as I needed these SVGs to be responsive. My main objective was to minimize the number of HTTP requests, leading me to explore the option of merging all SVG files into one SVG, defining symbols, and utilizing them as follows:
<svg style="display:none;">
<defs>
<symbol id="mys">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#3F77BC" d="
// SVG path data here
">
</symbol>
</defs>
</svg>
<div style="position:relative;width:100%;background:blue;">
<svg class="mys" viewBox="0 0 254 108" preserveAspectRatio="xMaxYMax meet" style="width:100%;">
<use xlink:href="#mys"></use>
<svg>
</div>
If you'd like to see this in action and observe the different behaviors across browsers, check out this jsfiddle link: http://jsfiddle.net/ws472q71/
Despite successfully getting this code to work in Firefox and Chrome, I faced compatibility issues with Internet Explorer. I tried various fixes suggested online but to no avail.
I'm seeking advice on what might be going wrong and if there are any alternative solutions that allow merging SVGs into a single file while maintaining responsiveness.
Your insights and suggestions would be greatly appreciated. Thank you!