1.

Explain the difference between <canvas> and<svg>.

Answer»

<canvas> and <svg> are two new graphical containers, used to create and STORE graphic elements in the HTML document. They have a few differences between them that are:

<canvas>
<svg>
<canvas> is a CONTAINER for drawing graphics using JavaScript.
<svg> is a container for graphics like ellipses, circles, rectangles, polygons, etc.
<canvas> is not scalable and is unsuitable for printing at HIGH resolution.
<svg> is scalable and can be printed in high resolution.
Modifying a <canvas> can only be done by scripting.
<svg> can be modified using the script as well as CSS.
<canvas> is a raster-based format that is made of pixels.
<svg> is vector-based graphic. These can be stretched or compressed without losing quality.
<canvas> performs better when there is a SMALL surface area or a large number of objects.
<svg> performs better when dealing with fewer objects or larger surface areas.


Discussion

No Comment Found