blue bar

Home  |  Resources SiteMap  

blue bar
    SVG Concepts > Basic Document Layout

Print Version      Previous       Next       

Basic Document Layout

An SVG document can stand by itself as a self-contained graphics file. The following example defines a standalone SVG file. The file must be saved with an .svg extension.

Code explanation

Line 1: Since SVG is an application of XML, it should always include the initial XML declaration.

Line 2 & 3 : defines the Document Type Declaration (DTD) to use. The DTD describes the language and syntax allowed in SVG.

Line 4 : The <svg> tag "tell" the browser this is an SVG document. The viewport of the SVG document is defined by the width and height properties. Not defining the width and the height properties cause the svg canvas to fill the browser dimensions. The x and y properties denote where the viewport will be placed in the browser window. The x property equates to the top position of the browser and the y property equates to the left position of the browser.

Line 5 : It defines the default XML namespace for this document.

Line 6 : All the SVG content would be placed between the <svg> </svg> tags.

Line 7 : Since SVG is an application of XML, all tags must be closed. The </svg> tag closes the document.

Previous       Next   

   
 

About the Tutorial

 

SVG Overview

 

SVG Concepts

  Rendering Concept
  SVG Document
 

Basic Document Layout

  SVG Data Types
  Styling SVG
  Grouping in SVG
  Referencing Objects
  Embedded SVG in HTML
  Quiz
 

Basic Drawing

 

Painting & Effects

 

Dynamic SVG