What is the difference between canvas and SVG in HTML5?

Canvas draws pixels using JavaScript. SVG describes shapes as XML elements.

PointCanvasSVG
TypeRaster (pixels)Vector (shapes)
Quality when zoomedBecomes blurryAlways sharp
Elements in the pageOne canvas element onlyEach shape is an element
CSS and events on shapesNoYes
Best forGames, charts with lots of data, image effectsIcons, logos, simple charts
<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" fill="orange" />
</svg>
Output in the browser

See HTML5 Canvas.


Learn more about the similar topics:
Tutorials
HTML Frames
HTML Iframes
HTML5 Introduction
HTML Multimedia
HTML5 Video
HTML5 Audio
HTML5 Canvas
Exercises & Assignments
No Content Found.
Interview Questions & Answers
What are the new multimedia elements in HTML5?
How do you insert a video in HTML?
What is the difference between HTML and HTML5?
What is an iframe in HTML and what is it used for?
What is the difference between canvas and SVG in HTML5?
What is the difference between localStorage, sessionStorage and cookies?