ArslArsl ArslArsl - 1 year ago 111
HTML Question

Can't insert sprite into svg

I wan't to insert sprite into my svg. Why this doesn't work?

<svg width="100" height="100">
<image xlink:href="blank.gif" class="flag flag-ru" x="10" y="10" height="50" width="50"></image>

But this work

<img src="blank.gif" class="flag flag-ru" alt="Czech Republic" />

I am using these sprites

How can I make the sprite work in my svg

Answer Source

These flag sprites shift <img> element's background-image via the CSS property background-position in order to display different parts of the larger image. Applying this CSS to SVG element <image> has no effect because the <image> element has no background-image or background-position.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download