How to add Scalable Vector Graphics (SVG) to your Web Page?

SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML and the XML is then rendered by an SVG viewer. Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG.

Note: If you already have an SVG file, then add it using <img> <object>, or <embed> tags.

To add SVG to web page, use <svg> element. Through this, you can easily embed SVG in HTML5 −

You can try to run the following code to add scalable vector graphics (SVG) to the web page:

<!DOCTYPE html>
         #svgelem {
            position: relative;
            left: 50%;
            -webkit-transform: translateX(-20%);
            -ms-transform: translateX(-20%);
            transform: translateX(-20%);
      <title>HTML5 SVG</title>

      <h2 align="center">HTML5 SVG Circle</h2>
      <svg id="svgelem" height="200" xmlns="">
         <circle id="bluecircle" cx="60" cy="60" r="50" fill="blue" />

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 26-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started