File structure

The basic structure of a SVG file is illustrated in the next example.

The first two attributes, "xmlns" and "xmlns:xlink" are required for stand alone svg files. I will not go into much detail about them.

The width and height attributes determine the size of the content. Pixels are the default units of measurement.

To create a SVG file, folow the next steps:

  • Create a file with the ".svg" extension
  • Copy the code from the right and paste it into the file
  • Open the file in a browser and you should see the image displayed on the left

The next example is for SVG used inside HTML (inline SVG).