04.07.2013 Views

Building Web Applications with SVG - Cdn.oreilly.com

Building Web Applications with SVG - Cdn.oreilly.com

Building Web Applications with SVG - Cdn.oreilly.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Diving In: A Step-by-Step Approach to <strong>Building</strong> a<br />

Simple <strong>SVG</strong> Document<br />

The following exercises are presented at a deliberately slow pace. Once you get the hang of how <strong>SVG</strong><br />

works (in some general way), the pace will quicken a good deal.<br />

A first file<br />

We already introduced a very simple example of an <strong>SVG</strong> file in this chapter, in the “Writing <strong>SVG</strong>” section.<br />

Let us re<strong>com</strong>mence at that point:<br />

1. Open a trusty text editor (something that allows you to see and save plain text—typically plain<br />

ASCII or UTF-8 in .txt format).<br />

2. Create a file containing the following lines of code, and save it as first.svg:<br />

<br />

<br />

<br />

3. Open the same file in a web browser. You can leave your text editor open because you may<br />

wish to later revise the file to add new things. For your browser, you may use a current version<br />

of Chrome, Firefox, Internet Explorer (see notes on this from the “Viewing <strong>SVG</strong>” section earlier<br />

in the chapter), Opera, or Safari.<br />

You should see something that looks like the image below, which shows screen shots of<br />

Firefox, Chrome, Opera, Internet Explorer, and Safari (from left to right, top to bottom).<br />

CHAPTER 1 <strong>SVG</strong> Basics 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!