HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

HTML Tags

HTML Tags

HTML <!DOCTYPE> TagHTML <html> TagHTML <head> TagHTML <title> TagHTML <body> TagHTML <base> TagHTML <link> TagHTML <meta> TagHTML <style> TagHTML <script> TagHTML <h1 to h6> TagHTML <hgroup> TagHTML <p> TagHTML <br> TagHTML <wbr> TagHTML <hr> TagHTML <pre> TagHTML <b> TagHTML <strong> TagHTML <i> TagHTML <em> TagHTML <mark> TagHTML <small> TagHTML <del> TagHTML <ins> TagHTML <sub> TagHTML <sup> TagHTML <u> TagHTML <blockquote> TagHTML <q> TagHTML <cite> TagHTML <abbr> TagHTML <address> TagHTML <bdo> TagHTML <bdi> TagHTML <a> TagHTML <nav> TagHTML <ul> TagsHTML <menu> TagHTML <ol> TagHTML <dl> TagHTML <img> TagHTML <figure> TagHTML <figcaption> TagHTML <audio> TagHTML <video> TagHTML <source> TagHTML <track> TagHTML <embed> TagHTML <object> TagHTML <param> Tag (Obsolete)HTML <picture> TagHTML <canvas> TagHTML <map> TagHTML <area> TagHTML <table> TagHTML <caption> TagHTML <thead> TagHTML <tbody> TagHTML <tfoot> TagHTML <tr> TagHTML <th> TagHTML <td> TagHTML <col> TagHTML <colgroup> TagHTML <form> TagHTML <input> TagHTML <textarea> TagHTML <button> TagHTML <select> TagHTML <selectedcontent> TagHTML <option> TagHTML <optgroup> TagHTML <label> TagHTML <fieldset> TagHTML <legend> TagHTML <datalist> TagHTML <output> TagHTML <meter> TagHTML <progress> TagHTML <header> TagHTML <footer> TagHTML <article> TagHTML <section> TagHTML <aside> TagHTML <main> TagHTML <search> TagHTML <details> TagHTML <summary> TagHTML <dialog> TagHTML <time> TagHTML <noscript> TagHTML <slot> TagsHTML <template> TagHTML <shadow> Tag (Obsolete)HTML <center> TagHTML <font> TagHTML <big> TagHTML <strike> TagHTML <tt> TagHTML <acronym> TagHTML <applet> TagHTML <frame> TagHTML <frameset> TagHTML <noframes> TagHTML <marquee> TagHTML <blink> TagHTML <s> TagHTML <var> TagHTML <kbd> TagHTML <samp> TagHTML <code> TagHTML <dfn> TagHTML <div> TagHTML <span> TagHTML Comment TagHTML <data> TagHTML Ruby Annotations: <ruby>, <rt> and <rp>HTML <svg> TagHTML <basefont> Tag
  1. Home
  2. /
  3. Tutorials
  4. /
  5. HTML Tutorial
  6. /
  7. HTML <svg> Tag

HTML Tags

HTML <svg> Tag

The <svg> tag is used to embed Scalable Vector Graphics (SVG) directly inside an HTML document.
SVG graphics are resolution-independent, meaning they scale without losing quality and are ideal for icons, diagrams, charts, and illustrations.
SVG elements are part of the HTML5 specification and work seamlessly with CSS and JavaScript.

Syntax

html

<svg width="width" height="height">
  <!-- SVG shapes go here -->
</svg>

Attributes

AttributeDescription
widthDefines the width of the SVG canvas
heightDefines the height of the SVG canvas
viewBoxDefines the coordinate system of the SVG
xmlnsDefines the SVG XML namespace
fillDefines fill color (can be overridden per shape)
strokeDefines stroke color
stroke-widthDefines stroke thickness
id, class, styleGlobal attributes

Example

html

<!DOCTYPE html>
<html>
<head>
  <title>SVG Tag Example</title>
</head>
<body>

<h2>SVG Example</h2>

<svg width="200" height="150" xmlns="http://www.w3.org/2000/svg">
  <rect x="10" y="10" width="180" height="130"
        fill="lightblue" stroke="black" stroke-width="2"/>
  <text x="50" y="80" fill="black" font-size="16">Hello SVG</text>
</svg>

</body>
</html>

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

SVG renders natively in modern browsers without any plugins.
IE9 partially support SVG tag

SVG Elements Reference

Basic Shape Elements

SVG ElementPurpose / Description
<rect>Draws rectangles and squares
<circle>Draws circles
<ellipse>Draws ellipses (oval shapes)
<line>Draws a straight line
<polyline>Draws connected straight lines
<polygon>Draws closed multi-sided shapes

Drawing & Text Elements

SVG ElementPurpose / Description
<path>Draws complex shapes using path commands
<text>Displays text inside SVG
<tspan>Styles or positions parts of SVG text

Grouping & Reusability Elements

SVG ElementPurpose / Description
<g>Groups multiple SVG elements
<defs>Stores reusable definitions
<use>Reuses elements defined in <defs>
<symbol>Defines reusable symbols

Gradient & Color Effects Element

SVG ElementPurpose / Description
<linearGradient>Creates linear color gradients
<radialGradient>Creates circular color gradients
<stop>Defines gradient color stops

Filters & Effects (Advanced)

SVG ElementPurpose / Description
<filter>Defines graphical effects
<feGaussianBlur>Applies blur effect
<feOffset>Moves image position
<feColorMatrix>Color transformations

Animation Elements (SVG SMIL)

SVG ElementPurpose / Description
<animate>Animates SVG attributes
<animateTransform>Animates transformations
<animateMotion>Animates movement along a path

Metadata & Interaction

SVG ElementPurpose / Description
<title>Tooltip / accessibility text
<desc>Description for screen readers
<a>Creates clickable links in SVG

Notes

  • SVG graphics are DOM elements, so they can be styled with CSS and manipulated with JavaScript.
  • SVG is different from <canvas> - SVG is vector-based, canvas is pixel-based.
  • Inline SVG is preferred over image-based SVG for better interactivity and styling.

Conclusion

The <svg> tag enables powerful, scalable, and interactive vector graphics in HTML.
It is an essential modern web technology for icons, visualizations, and responsive design.

PreviousHTML Ruby Annotations: <ruby>, <rt> and <rp>NextHTML <basefont> Tag