More Related Content
Similar to Svg Basics (20)
Svg Basics
- 2. Im Vergleich zu z.B. PNG
firefox.png firefox.svg
128px × 128px ∞
21KB 46KB
21KB (gzip) 13KB (gzip)
- 15. Styling auch per CSS
svg rect.someClass {
stroke: #0283c5;
stroke-width: 6;
fill: none;
}
- 19. Skalierung um das Zentrum
<!-- translate(-centerX*(factor-1), -centerY*(factor-1))
scale(factor) -->
<rect x="150" y="100" width="100" height="100"
transform="translate(50, -75) scale(.75, 1.5)" />
- 23. Gruppierung von Elementen
<g stroke="#73d216" fill="#73d216" fill-opacity="0.4" stroke-width="3" fill="none"
<rect x="0" y="0" width="200" stroke="red" height="150" />
<ellipse cx="200" cy="150" rx="150" ry="75" />
</g>
- 26. Inline im HTML verwenden
<h1>Some Heading</h1>
<div class="image">
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="400" height="300"
<!-- ... -->
</svg>
</div>
- 28. Als CSS-Background einbinden
.logo {
display: block;
text-indent: -9999px;
width: 279px;
height: 132px;
background: url(brainbits.svg);
background-size: 279px 132px;
}
- 29. Fallback z.B. mit Modernizr
<img class="logo" src="myImage.svg" data-fallback="myImage.png" />
<script>
</script>
if (!Modernizr.svg) {
var image = $("img.logo");
image.attr("src", image.data('fallback'));
}
- 31. Referenzen
Scalable Vector Graphics – Wikipedia
W3C Recommendation – SVG 1.1 2nd Edition
O'Reily SVG Essentials – Transforming the
Coordinate System
CSS-Tricks – Using SVG
© 2013 Michael van Engelshoven