Home :: Tutorials :: SVG :: Basic Document

Below is the skeleton of a basic SVG document. This structure is used as a starting point for all examples on this site. Right-click (or option-click) here to download this file.


<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>


<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"




<svg xmlns="http://www.w3.org/2000/svg"




    <-- SVG content goes here -->



Line 1 This is an XML declaration which specifies that this is an XML document that conforms to the XML 1.0 specification.
Lines 2-3 This is an XML document type declaration which specifies the grammar for this file. The SVG grammar is defined in the SVG 1.0 DTD.
Line 4 This is the root of the XML document. We create an svg element since the document type declaration states that the root element must be an svg tag. This element also defines the default XML namespace for this document.

The svg element has many attributes that effect the overall SVG document. Be sure to take a look at the SVG 1.0 specification for descriptions of these attributes and much more.

Line 5 This line defines the xlink namespace which is used to reference external images and elements within an SVG document.
Line 6 The content of your SVG document will live here.
Line 7 We close the initial svg element to complete our well-formed and valid SVG document.