1. What is SVG.
SVG refers to scalable vector graphics (Scalable vector Graphics) SVG is used to define vector based graphics SVG for networks use XML format to define graphics SVG images without any loss of graphic quality in the case of zooming or resizing SVG is the standard of the World Wide Web Consortium
2.SVG Advantage
Compared to other image formats (such as JPEG and GIF), the advantage of using SVG is:
SVG images can be created and modified by a text editor to be searchable, indexed, scripted, or compressed SVG images are scalable SVG images can be printed at any resolution with high quality SVG can be magnified without image quality degradation
3. Embed SVG directly into HTML page
<! DOCTYPE html>
The effect chart is as follows:
The difference between 4.SVG and canvas
SVG is a language that uses XML to describe 2D graphics.
Canvas uses JavaScript to draw 2D graphics.
SVG is xml-based, which means that every element in the SVG DOM is available. You can attach a JavaScript event handler for an element.
In SVG, each drawn graphic is treated as an object. If the properties of the SVG object change, the browser can reproduce the graphic automatically.
Canvas is rendered in pixels. In canvas, once the graphic has been drawn, it will not continue to get the attention of the browser. If its position changes, the entire scene needs to be redrawn, including any object that may have been covered by the graphic.