How to include SVG code inside HTML file ?
Introduction: SVG stands for Scalable Vector Graphics. It written in XML based format that is used to describe vector graphics. It is widely supported in browsers like Google Chrome, Firefox, Opera, etc. and many of them have the tendency to render SVG images. Designers also use SVG format for making the illustrations like logo, icons, etc. as they are pixel-perfect at any resolution.
In this article, we will insert a sample SVG code in the HTML file that will help you to include any SVG code that you want in your own HTML file.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
<svg> Tag: In order to include SVG code, we have to use <svg> tag in the HTML code. It is a container which is used for SVG graphics. It is written inside the <body> section of the HTML file. It has both opening and closing tags. We also use width and height attributes with the <svg> tag.
Now let’s see an example to understand it better.