I recommend putting svg inline in your document (html5 method). Just open your SVG file, copy the SVG tag and everything in it, and then paste it into your html document.
<html> <body> <svg></svg> </body> </html>
This has the advantage that it allows you to use CSS to style it, for example, changing the fill color or applying filters to it, like blurring. Another advantage is that you save one HTTP request to retrieve the svg file if it is inside your document.
If you want, for example, to change your position with css, then you should put css inside the style attribute. Styles that are in the external css file will not be applied in most browsers, as this is a security restriction. For example:
<svg id="mySVG" style="position: absolute; top: 200px; left: 200px;"></svg>
This method is supported by all browsers except IE8 and below, as well as the browser android 2.3 and below.
Read more in the SVG chapter:
If you do not want to place it on your page, the object tag is the best option and avoid using the embed tag.
Read this for more details on the vs embed vs img tag object:
chrisweb Sep 23 '13 at 21:00 2013-09-23 21:00
source share