The easiest way to embed SVG / SVGZ Vector Graphics in an HTML website (for all major browsers 2016)

What is the easiest way to embed vector SVG or compressed SVGZ illustrations on a website?
It should work correctly under versions of Firefox, Chrome, Opera and Safari and Internet Explorer 2016.

+4
source share
4 answers

it will help you ...

<embed src="svg.svgz" width="200px" height="200px" type="image/svg+xml" /> 
+8
source

IE8 does not support SVG in any way (without additional libraries such as SVGWeb), so you won’t be able to make it work regardless of your markup.

Although the method you describe works well, I personally prefer to include SVG inline in XHTML, as it allows me to mix CSS styles for HTML and SVG together and provide a complete mix of JavaScript. I have an example of this here: http://phrogz.net/svg/3-point-circle.xhtml

Be sure to submit .xhtml files as Content-Type:application/xhtml+xml from your web server.

+5
source

You can convert SVG to Raphael.is. This will make it work in IE6 and higher, as well as in Webkit browsers. Look at this image when you're done, click on the links to go to the page and the SVGTOHTML tool. Not sure about SVGZ, but these files are quite compact and work on SVG for Webkit and are called VML in proprietary IE.

http://www.irunmywebsite.com/raphael/teacup.php Apologies for writing text on your iPod!

+3
source

You can use svgweb, a toolbox that creates embedded SVG objects compatible with crossbrowser. For IE, it automatically creates a Flash file.

http://code.google.com/p/svgweb/

+2
source

Source: https://habr.com/ru/post/1339303/


All Articles