<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800" height="800" viewBox="0 0 800 800">
<g id="background">
<rect x="-1" fill="#99CCCC" width="800" height="800"/>
<defs>
<rect id="SVGID_1_" x="-1" width="800" height="800"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_2_)" fill="#7CB5AB" points="683.2 969.4 978 553.7 471.2 128.7 432.6 146 389.7 503.7 176.4 544.4 "/>
</g>
<g id="objects">
<path fill="#FFFFFF" d="M397.8 746.2h0.7v-0.8c0-0.9 0.1-1.6 0.3-2.1 0.2-0.5 0.6-0.9 1.1-1.1 0.5-0.2 1.3-0.4 2.2-0.4 1.6 0 2.5 0.4 2.5 1.2 0 0.3-0.1 0.5-0.3 0.7 ..."/>
<!-- ... -->
</g>
</svg>
SVG images, being XML, contain many repeated fragments of text, so they are well suited for lossless data compression algorithms. [...] An SVGZ file is typically 20 to 50 percent of the original size.
— Wikipedia
Best way is to compare and choose accordingly.
<svg viewBox=".." role="img" aria-labelledby="title description"> <title id="title">Chemical Reaction</title> <desc id="description">Animated illustration showing the stages of a chemical reaction in a laboratory.</desc> </svg>
(Tools & Resources)
Notes:
<img src="logo.svg" alt="Company Logo" />
.logo { background-image: url(logo.svg); }
<object type=”image/svg+xml” data=”mySVG.svg”>
<!-- fallback here -->
</object>
<object type=”image/svg+xml” data=”mySVG.svg”>
<img src="fallback.png" alt="..." />
</object>
<object type=”image/svg+xml” data=”mySVG.svg”>
<div id="fallback"></div>
</object>
#fallback {
background: url(fallback.png);
width: 15em;
height: 12em;
...
}
<iframe src=”mySVG.svg”>
<!-- fallback here -->
</iframe>
<embed type=”image/svg+xml” src=”mySVG.svg” />
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ..>
<!-- svg content -->
</svg>
<img src='data:image/svg+xml; ... '>
<img src='data:image/svg+xml;utf8,<svg...> ... </svg>'>
.logo { background: url('data:image/svg+xml;utf8,<svg...> ... </svg>'); }
<img src='data:image/svg+xml;base64,...'>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="icon-twitter" viewBox="0 0 35 35"> <!-- Twitter icon markup --> </symbol> <symbol id="icon-github" viewBox="0 0 35 35"> <!-- Github icon markup --> </symbol> <!-- more icons here... --> </svg>
<svg class="icon-twitter"> <use xlink:href="#icon-twitter"></use> </svg>
<svg class="icon-twitter"> <use xlink:href="icons.svg#icon-twitter"></use> </svg>
Does not work in any version of IE.
.icon-dribbble { background-image: url('data:image/svg+xml;...'); background-repeat: no-repeat; }
Fallback:
.icon-dribbble { background-image: url('data:image/png;base64,...'); }
.icon-dribbble { background-image: url('png/dribbble.png'); }
Fallback Fallback:
These Slides:
https://slides.com/sarasoueidan/working-with-svg-a-primer/
@SaraSoueidan
http://sarasoueidan.com