Inserting SVG in HTML

This page demonstrates various methods to include SVG in an HTML document.

<embed>

Supported in all major browsers. Deprecated in HTML4 and XHTML but allowed in HTML5.

<object>

Supported in all major browsers and is standard in HTML4, XHTML, and HTML5.

<iframe>

Supported in all major browsers. Not allowed in HTML4/XHTML Strict DTD

<img>

Supported in contemporary browsers (including IE9).

<div> (CSS background)

#svgcss { height: 100px; width: 180px; background-image: url('./svg/simple-shapes-css.svg'); background-repeat: no-repeat; }

Supported in contemporary browsers (including IE9).

<svg> (Inline)

Supported in contemporary browsers (including IE9).