XML technologies / SVG / Creating simple SVG graphics / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
The tag
<circle>can only create circles, whose vertical and horizontal radii are always equal and specified by therattribute. The<ellipse>tag lets you specify both radii separately, allowing you to draw both circles and ellipses.Create an empty text file in your editor and save it with the filename extension .svg. Then insert the following code and save the changes again.
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg></svg>
The circle’s code is:
<circle cx="50" cy="50" r="10"/>To define the color, add a
styleattribute to the tag:<circle cx="50" cy="50" r="10" style="fill:blue;stroke:red"/>The HTML code for displaying the file should be:
<HTML>
<HEAD>
<TITLE>Lösungen KAP02</TITLE>
</HEAD>
<BODY>
<EMBED src="KAP02.svg" type="image/svg-xml" />
</BODY>
</HTML>
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top