Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Look into the <foreignObject> tag #1

Open
lukewhitehouse opened this issue Jun 8, 2015 · 1 comment
Open

Look into the <foreignObject> tag #1

lukewhitehouse opened this issue Jun 8, 2015 · 1 comment

Comments

@lukewhitehouse
Copy link
Owner

Based on @daviddarnes comment over on Designer News

@daviddarnes
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants