<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>SVG test </title> </head> <body> <div> <div>embedding SVG with img tag</div> <div><img src="test.svg"/></div> <div> <div> <div>embedding inline SVG</div> <div> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="40mm" height="28.63mm" viewBox="0 0 90.00 81.14"> <rect x="1" y="1" width="60" height="60" fill="none" stroke="red" stroke-width="2"/> <circle cx="40" cy="44" r="30" fill="none" stroke="yellow" stroke-width="10" /> <text x="24" y="48">SVG</text> </svg> </div> </body> </html>
test.svg
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="40mm" height="28.63mm" viewBox="0 0 90.00 81.14"> <rect x="1" y="1" width="60" height="60" fill="none" stroke="purple" stroke-width="2"/> <circle cx="40" cy="44" r="30" fill="red" stroke="blue" stroke-width="10" /> <text x="24" y="48">SVG</text> </svg>
The result looks like presented below
A quick test showed the following:
ReplyDeleteIE8 doesn't show images at all, only text for inline svg;
Chrome 22 fails with img tag, text is missing;
Firefox 14 works perfectly with both cases!
Eternal inter-browser issues =)
BTW, I've reported this issue to Google with a link to your post ;)
ReplyDeleteit was an error in the SVG.. somehow i managed to set the @width and @height attributes twice. Should be fixed now.
ReplyDeleteHi Ivan, i just checked and yes... it seems like chrome does not properly display the text. Thx for reporting the issue.
ReplyDelete