SlideShare a Scribd company logo
1 of 20
SVG(ScalableSVG(Scalable
Vector Graphics)Vector Graphics)
infobizzs.com
What is SVG?What is SVG?
• SVG stands for Scalable Vector Graphics.
• SVG defines vector-based graphics in XML format.
• SVG stands for Scalable Vector Graphics.
• SVG is used to define vector-based graphics for the Web.
• SVG defines the graphics in XML format.
• SVG graphics do NOT lose any quality if they are zoomed or
resized .
• Every element and every attribute in SVG files can be animated.
• SVG is a W3C recommendation.
• SVG integrates with other W3C standards such as the DOM and
XSL.
infobizzs.com
SVG AdvantagesSVG Advantages
Advantages of using SVG over other image formats (like JPEG and
GIF) are:
• SVG images can be created and edited with any text editor
• SVG images can be searched, indexed, scripted, and
compressed
• SVG images are scalable
• SVG images can be printed with high quality at any
resolution
• SVG images are zoomable (and the image can be zoomed
without degradation)
• SVG is an open standard
• SVG files are pure XML
infobizzs.com
SVG in HTMLSVG in HTML
• In HTML5, you can embed SVG elements directly into your
HTML pages.
• Here is an example of a simple SVG graphic:
• and here is the HTML code:
infobizzs.com
ExampleExample
<!DOCTYPE html>
<html>
<body>
<h1>My first SVG</h1>
<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-
width="4" fill="yellow" />
</svg>
</body>
</html>
infobizzs.com
OutputOutput
infobizzs.com
SVG Code explanation:SVG Code explanation:
infobizzs.com
• An SVG image begins with an <svg> element
• The width and height attributes of the <svg> element define the
width and height of the SVG image
• The <circle> element is used to draw a circle
• The cx and cy attributes define the x and y coordinates of the
center of the circle. If cx and cy are omitted, the circle's center is set
to (0, 0)
• The r attribute defines the radius of the circle
• The stroke and stroke-width attributes control how the outline of a
shape appears. We set the outline of the circle to a 4px green
"border“
•
• The fill attribute refers to the color inside the circle. We set the fill
color to yellow
• The closing </svg> tag closes the SVG image
SVG ShapesSVG Shapes
SVG has some predefined shape elements that can be used by
developers:
• Rectangle <rect>
• Circle <circle>
• Ellipse <ellipse>
• Line <line>
• Polyline <polyline>
• Polygon <polygon>
• Path <path>
infobizzs.com
SVG Rectangle - <rect>SVG Rectangle - <rect>
• The <rect> element is used to create a rectangle and variations
of a rectangle shape:
• Here is the SVG code:
infobizzs.com
ExampleExample
<svg width="400" height="110">
  <rect width="300" height="100“
style="fill:rgb(0,0,255);
stroke-width:3;stroke:rgb(0,0,0)" />
</svg>
OutputOutput
infobizzs.com
Code explanation:Code explanation:
• The width and height attributes of the <rect> element define the
height and the width of the rectangle
• The style attribute is used to define CSS properties for the
rectangle
• The CSS fill property defines the fill color of the rectangle
• The CSS stroke-width property defines the width of the border of
the rectangle
• The CSS stroke property defines the color of the border of the
rectangle
infobizzs.com
SVG Circle - <circle>SVG Circle - <circle>
• The <circle> element is used to create a circle:
• Here is the SVG code:
infobizzs.com
ExampleExample
<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-
width="3" fill="red" />
</svg>
OutputOutput
infobizzs.com
Code explanation:Code explanation:
• The cx and cy attributes define the x and y coordinates of the
center of the circle. If cx and cy are omitted, the circle's center is
set to (0,0)
• The r attribute defines the radius of the circle
infobizzs.com
SVG Ellipse - <ellipse>SVG Ellipse - <ellipse>
• The <ellipse> element is used to create an ellipse.
• An ellipse is closely related to a circle. The difference is that an
ellipse has an x and a y radius that differs from each other, while
a circle has equal x and y radius:
• The following example creates an ellipse:
• Here is the SVG code:
infobizzs.com
ExampleExample
• <svg height="140" width="500">
  <ellipse cx="200" cy="80" rx="100" ry="50"
  style="fill:yellow;stroke:purple;stroke-width:2" />
</svg>
Output
infobizzs.com
Code explanation:Code explanation:
• The cx attribute defines the x coordinate of the center
of the ellipse
• The cy attribute defines the y coordinate of the center
of the ellipse
• The rx attribute defines the horizontal radius
• The ry attribute defines the vertical radius
infobizzs.com
SVG Line - <line>SVG Line - <line>
• The <line> element is used to create a line:
• Here is the SVG code:
infobizzs.com
ExampleExample
<svg height="210" width="500">
<line x1="0" y1="0" x2="200" y2="200"
style="stroke:rgb(255,0,0);stroke-width:2" />
</svg>
OutputOutput
infobizzs.com
Code explanation:Code explanation:
• The x1 attribute defines the start of the line on the x-
axis
• The y1 attribute defines the start of the line on the y-
axis
• The x2 attribute defines the end of the line on the x-
axis
• The y2 attribute defines the end of the line on the y-
axis
infobizzs.com

More Related Content

What's hot (20)

Css
CssCss
Css
 
Css Text Formatting
Css Text FormattingCss Text Formatting
Css Text Formatting
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Css
CssCss
Css
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 Canvas
 
Web Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScriptWeb Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScript
 
Javascript
JavascriptJavascript
Javascript
 
CSS Positioning Elements.pdf
CSS Positioning Elements.pdfCSS Positioning Elements.pdf
CSS Positioning Elements.pdf
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Web Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSSWeb Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSS
 
CSS
CSSCSS
CSS
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
 
html5.ppt
html5.ppthtml5.ppt
html5.ppt
 

Viewers also liked

HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVGyarcub
 
제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP
 제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP 제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP
제 5회 DGMIT R&D 컨퍼런스: HTML Graphics APdgmit2009
 
SVG For Web Designers (and Developers)
SVG For Web Designers (and Developers) SVG For Web Designers (and Developers)
SVG For Web Designers (and Developers) Sara Soueidan
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examplesAlfredo Torre
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to BootstrapRon Reiter
 

Viewers also liked (7)

HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVG
 
제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP
 제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP 제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP
제 5회 DGMIT R&D 컨퍼런스: HTML Graphics AP
 
SVG For Web Designers (and Developers)
SVG For Web Designers (and Developers) SVG For Web Designers (and Developers)
SVG For Web Designers (and Developers)
 
Bootstrap ppt
Bootstrap pptBootstrap ppt
Bootstrap ppt
 
Bootstrap ppt
Bootstrap pptBootstrap ppt
Bootstrap ppt
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 

Similar to Svg

SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)Filip Van Laenen
 
SVG - Scalable Vector Graphics
SVG - Scalable Vector GraphicsSVG - Scalable Vector Graphics
SVG - Scalable Vector GraphicsShweta Sadawarte
 
SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)Filip Van Laenen
 
Drawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the WebDrawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the WebCloudinary
 
Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3Pascal Rettig
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSGil Fink
 
MTA managing the graphical interface by using css
MTA managing the graphical interface by using cssMTA managing the graphical interface by using css
MTA managing the graphical interface by using cssDhairya Joshi
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?Mike Wilcox
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvasGary Yeh
 
Graphics 2D SVG
Graphics 2D SVGGraphics 2D SVG
Graphics 2D SVGMinh Huong
 
Html5 Canvas Detail
Html5 Canvas DetailHtml5 Canvas Detail
Html5 Canvas DetailNisa Soomro
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive GraphicsBlazing Cloud
 

Similar to Svg (20)

5. SVG.pptx
5. SVG.pptx5. SVG.pptx
5. SVG.pptx
 
SVG Animations
SVG AnimationsSVG Animations
SVG Animations
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
 
SVG - Scalable Vector Graphics
SVG - Scalable Vector GraphicsSVG - Scalable Vector Graphics
SVG - Scalable Vector Graphics
 
SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)
 
Drawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the WebDrawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the Web
 
Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJS
 
MTA managing the graphical interface by using css
MTA managing the graphical interface by using cssMTA managing the graphical interface by using css
MTA managing the graphical interface by using css
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
SVG and the web
SVG and the webSVG and the web
SVG and the web
 
Graphics 2D SVG
Graphics 2D SVGGraphics 2D SVG
Graphics 2D SVG
 
Html 5 svg
Html 5 svgHtml 5 svg
Html 5 svg
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
Learn svg
Learn svgLearn svg
Learn svg
 
SVG overview
SVG overviewSVG overview
SVG overview
 
Html5 Canvas Detail
Html5 Canvas DetailHtml5 Canvas Detail
Html5 Canvas Detail
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
 
Iagc2
Iagc2Iagc2
Iagc2
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Svg

  • 2. What is SVG?What is SVG? • SVG stands for Scalable Vector Graphics. • SVG defines vector-based graphics in XML format. • SVG stands for Scalable Vector Graphics. • SVG is used to define vector-based graphics for the Web. • SVG defines the graphics in XML format. • SVG graphics do NOT lose any quality if they are zoomed or resized . • Every element and every attribute in SVG files can be animated. • SVG is a W3C recommendation. • SVG integrates with other W3C standards such as the DOM and XSL. infobizzs.com
  • 3. SVG AdvantagesSVG Advantages Advantages of using SVG over other image formats (like JPEG and GIF) are: • SVG images can be created and edited with any text editor • SVG images can be searched, indexed, scripted, and compressed • SVG images are scalable • SVG images can be printed with high quality at any resolution • SVG images are zoomable (and the image can be zoomed without degradation) • SVG is an open standard • SVG files are pure XML infobizzs.com
  • 4. SVG in HTMLSVG in HTML • In HTML5, you can embed SVG elements directly into your HTML pages. • Here is an example of a simple SVG graphic: • and here is the HTML code: infobizzs.com
  • 5. ExampleExample <!DOCTYPE html> <html> <body> <h1>My first SVG</h1> <svg width="100" height="100">   <circle cx="50" cy="50" r="40" stroke="green" stroke- width="4" fill="yellow" /> </svg> </body> </html> infobizzs.com
  • 7. SVG Code explanation:SVG Code explanation: infobizzs.com • An SVG image begins with an <svg> element • The width and height attributes of the <svg> element define the width and height of the SVG image • The <circle> element is used to draw a circle • The cx and cy attributes define the x and y coordinates of the center of the circle. If cx and cy are omitted, the circle's center is set to (0, 0) • The r attribute defines the radius of the circle • The stroke and stroke-width attributes control how the outline of a shape appears. We set the outline of the circle to a 4px green "border“ • • The fill attribute refers to the color inside the circle. We set the fill color to yellow • The closing </svg> tag closes the SVG image
  • 8. SVG ShapesSVG Shapes SVG has some predefined shape elements that can be used by developers: • Rectangle <rect> • Circle <circle> • Ellipse <ellipse> • Line <line> • Polyline <polyline> • Polygon <polygon> • Path <path> infobizzs.com
  • 9. SVG Rectangle - <rect>SVG Rectangle - <rect> • The <rect> element is used to create a rectangle and variations of a rectangle shape: • Here is the SVG code: infobizzs.com
  • 10. ExampleExample <svg width="400" height="110">   <rect width="300" height="100“ style="fill:rgb(0,0,255); stroke-width:3;stroke:rgb(0,0,0)" /> </svg> OutputOutput infobizzs.com
  • 11. Code explanation:Code explanation: • The width and height attributes of the <rect> element define the height and the width of the rectangle • The style attribute is used to define CSS properties for the rectangle • The CSS fill property defines the fill color of the rectangle • The CSS stroke-width property defines the width of the border of the rectangle • The CSS stroke property defines the color of the border of the rectangle infobizzs.com
  • 12. SVG Circle - <circle>SVG Circle - <circle> • The <circle> element is used to create a circle: • Here is the SVG code: infobizzs.com
  • 13. ExampleExample <svg height="100" width="100">   <circle cx="50" cy="50" r="40" stroke="black" stroke- width="3" fill="red" /> </svg> OutputOutput infobizzs.com
  • 14. Code explanation:Code explanation: • The cx and cy attributes define the x and y coordinates of the center of the circle. If cx and cy are omitted, the circle's center is set to (0,0) • The r attribute defines the radius of the circle infobizzs.com
  • 15. SVG Ellipse - <ellipse>SVG Ellipse - <ellipse> • The <ellipse> element is used to create an ellipse. • An ellipse is closely related to a circle. The difference is that an ellipse has an x and a y radius that differs from each other, while a circle has equal x and y radius: • The following example creates an ellipse: • Here is the SVG code: infobizzs.com
  • 16. ExampleExample • <svg height="140" width="500">   <ellipse cx="200" cy="80" rx="100" ry="50"   style="fill:yellow;stroke:purple;stroke-width:2" /> </svg> Output infobizzs.com
  • 17. Code explanation:Code explanation: • The cx attribute defines the x coordinate of the center of the ellipse • The cy attribute defines the y coordinate of the center of the ellipse • The rx attribute defines the horizontal radius • The ry attribute defines the vertical radius infobizzs.com
  • 18. SVG Line - <line>SVG Line - <line> • The <line> element is used to create a line: • Here is the SVG code: infobizzs.com
  • 19. ExampleExample <svg height="210" width="500"> <line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" /> </svg> OutputOutput infobizzs.com
  • 20. Code explanation:Code explanation: • The x1 attribute defines the start of the line on the x- axis • The y1 attribute defines the start of the line on the y- axis • The x2 attribute defines the end of the line on the x- axis • The y2 attribute defines the end of the line on the y- axis infobizzs.com