SVG Tutorial


SVG stands for Scalable Vector Graphics.

SVG is an XML markup language used to describe two-dimensional graphics. Unlike bitmap images, SVG images are stored as text and can be scaled to any size without distortion because they are based on mathematical descriptions rather than pixels.

SVG graphics are scalable and resolution-independent, which means they can be enlarged or reduced without distortion.

SVG is widely used in web design, icon creation, data visualization, and other graphics-related fields.


Main Features of SVG

  • Vector Graphics:SVG uses path-based vector graphics, which means the graphics can be infinitely enlarged without distortion.
  • Scalability:SVG files remain sharp at different resolutions, making them suitable for responsive design.
  • Interactivity:SVG can be combined with JavaScript to achieve animation and interactive effects.
  • Integration:SVG can be directly embedded in HTML5 without the need for external files.
  • Compatibility:Most modern browsers support SVG.

Application Scenarios of SVG

  • Web Icons:Due to SVG's scalability, it is very suitable for creating web icons.
  • Data Visualization:SVG is often used to create charts and graphs, such as bar charts, pie charts, etc.
  • Animation:SVG can be combined with CSS and JavaScript to create complex animation effects.
  • Game Development:In some cases, SVG is also used to create simple game graphics.
  • Design Prototypes:Designers can use SVG to create interactive design prototypes.

A Simple Example

We created a simple red circle with a black border:

SVG Examples

<html> <body> <h1>My first SVG</h1> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> </svg> </body> </html>

Try it Yourself »

Click the "Try it Yourself" button to view the running result.

SVG Examples

You can edit SVG examples online and view the running results online!

Online Examples

SVG Reference Manual

In Example, we provide you with a complete SVG reference manual, which lists all SVG elements in the W3C recommendation (SVG Version 1.1).

SVG Reference Manual

SVG Online Editor

Other Extensions