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

SVGWeb DevelopmentFront End Scripts

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>
<html>
   <head>
      <style>
         #svgelem {
            position: relative;
            left: 50%;
            -webkit-transform: translateX(-20%);
            -ms-transform: translateX(-20%);
            transform: translateX(-20%);
         }
      </style>
      <title>HTML5 SVG</title>
   </head>

   <body>
      <h2 align="center">HTML5 SVG Circle</h2>
      <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
         <circle id="bluecircle" cx="60" cy="60" r="50" fill="blue" />
      </svg>
   </body>
</html>
raja
Published on 25-Jan-2018 09:44:23
Advertisements