Open lukewhitehouse opened 9 years ago
Case example:
<svg class="icon" viewBox="0 0 50 50">
<switch>
<use xlink:href="#twitter-icon"></use>
<foreignObject>
<img class="icon" src="img/twitter-icon.png" alt="twitter">
</foreignObject>
</switch>
</svg>
The SVG sprite works in the same way, however the <use>
is wrapped in a <switch>
element and a <foreignObject>
is added in. The switch acts as a conditional statement. If the browser doesn't support the XML code within it, it'll use whatever is inside the foreignObject instead.
Based on @daviddarnes comment over on Designer News