SlideShare a Scribd company logo
1 of 32
Download to read offline
SVG
Scalable Vector Graphics
Im Vergleich zu z.B. PNG
firefox.png firefox.svg
128px × 128px ∞
21KB 46KB
21KB (gzip) 13KB (gzip)
Browser-Support
3.0+ 4.0+ 3.1+ 9.0+ 9.0+
XML-Dokument
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg"
version="1.0"
width="400"
height="300">
<!-- ... -->
</svg>
Basiselemente
Rechtecke
<rect width="66" height="30" x="21" y="32" />
Kreise & Ellipsen
<circle cx="75" cy="100" r="50" />
<ellipse cx="200" cy="150" rx="150" ry="75" />
Pfade
<path d="M 12,10 C 39,22 43,50 9,52 C 62,114 101,145 101,145" />
Polygone
<path d="M 149,109 L 149,127 L 127,144 L 140,172 L 188,167 L 191,119 z" />
Text
Hello, out there
<text x="0" y="150" font-family="Verdana" font-size="45" fill="#c4a000">
Hello, out there
</text>
Styling der Elemente
Stroke
<circle ... stroke="red" stroke-width="5" stroke-opacity=".5" />
Gestrichelte Linien
<rect ... stroke="blue" stroke-width="2" stroke-dashArray="20 5 10 5" />
Fill
<circle ... fill="rgb(255, 0, 0)" fill-opacity=".5" />
Styling auch per CSS
svg rect.someClass {
stroke: #0283c5;
stroke-width: 6;
fill: none;
}
Transformationen
Verschiebung
<rect x="150" y="100" width="100" height="100" ... transform="translate(-50 -50)" />
Skalierung
<rect x="150" y="100" width="100" height="100" ... transform="scale(.75, 1.5)" />
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)" />
Drehung
<rect x="150" y="100" width="100" height="100" ... transform="rotate(45 200 150)" />
Scherung X-Achse
<rect x="150" y="100" width="100" height="100" ... transform="skewX(20)" />
Scherung Y-Achse
<rect x="150" y="100" width="100" height="100" ... transform="skewY(20)" />
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>
Clipping
<clipPath id="clip-box">
<rect x="0" y="0" width="200" height="150" />
</clipPath>
<ellipse cx="200" cy="150" rx="150" ry="75" />
SVG in HTML einbinden
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>
Als externes Bild einbinden
<img class="logo" src="myImage.svg" />
Als CSS-Background einbinden
.logo {
display: block;
text-indent: -9999px;
width: 279px;
height: 132px;
background: url(brainbits.svg);
background-size: 279px 132px;
}
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'));
}
Viel Spass!
http://slidesha.re/W1R1Nh
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
© 2013 Michael van Engelshoven

More Related Content

Similar to Svg Basics

Фабрика "Blockly" (исправлено)
Фабрика "Blockly" (исправлено)Фабрика "Blockly" (исправлено)
Фабрика "Blockly" (исправлено)
OlesiaJL
 
Web accessibility
Web accessibilityWeb accessibility
Web accessibility
Eb Styles
 
MOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize thisMOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize this
Boris Zapolsky
 

Similar to Svg Basics (20)

SVG overview
SVG overviewSVG overview
SVG overview
 
Фабрика "Blockly" (исправлено)
Фабрика "Blockly" (исправлено)Фабрика "Blockly" (исправлено)
Фабрика "Blockly" (исправлено)
 
HTML 5 گرافیک دو بعدی در
HTML 5 گرافیک دو بعدی در HTML 5 گرافیک دو بعدی در
HTML 5 گرافیک دو بعدی در
 
Css6 svg
Css6 svgCss6 svg
Css6 svg
 
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for Beginners
 
Setting the Stage for SVG Animation
Setting the Stage for SVG AnimationSetting the Stage for SVG Animation
Setting the Stage for SVG Animation
 
CANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEventCANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEvent
 
Html5 SVG
Html5 SVGHtml5 SVG
Html5 SVG
 
Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
 
D3 svg & angular
D3 svg & angularD3 svg & angular
D3 svg & angular
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the World
 
Web base - SVG
Web base - SVGWeb base - SVG
Web base - SVG
 
D3
D3D3
D3
 
SVG and the web
SVG and the webSVG and the web
SVG and the web
 
Flash Camp - Degrafa & FXG
Flash Camp - Degrafa & FXGFlash Camp - Degrafa & FXG
Flash Camp - Degrafa & FXG
 
STC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first helpSTC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first help
 
Web accessibility
Web accessibilityWeb accessibility
Web accessibility
 
MOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize thisMOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize this
 
Tiling
TilingTiling
Tiling
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Svg Basics