| Diese Seite ist gerade im Aufbau: | |||
Typischer Aufbau einer SVG-DateiEs gibt 3 Wege, um SVG zu konstruieren und definieren:
|
|
||
Alleinstehende SVG-DateiThe following example defines a standalone SVG file. The file must be saved with an .svg extension:
The first line in the example above contains the XML declaration. Since SVG is an XML application it should always include the XML declaration. The second and third line defines the Document Type Declaration (DTD) to use. The DTD describes the language and syntax allowed in SVG. The fourth line contains the <svg> tag. This tag "tells" the browser that this is an SVG document. The canvas of the SVG document is defined by the width and height attributes. If you do not define the width and height attributes the svg canvas will fill the browser dimensions. The x and y attributes specifies where the canvas will be placed in the browser window. The fifth, sixth, and seventh line: Where to place all the SVG elements. The last line, </svg>, closes the document. Since SVG is XML-based most of the search engines will not pick up a standalone SVG page. To solve this problem we can add SVG as an embedded element in an XHTML page. SVG as an Embedded ElementThe following example shows how to embed SVG within an XHTML document:
The example above is a straightforward XHTML document. Notice the use of the <object> and <embed> tags. According to the XHTML standard we should only use the <object> tag, but since Netscape does not support this tag we find it best to use both the <object> and <embed> tags. By using this method the document will be picked up by search engines. This method also makes it easier to integrate other objects (e.g. sound, music, Flash) on the same web page. I think this method is the preferred one, until SVG is supported by the major browsers.
|
|||