04.07.2013 Views

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The <strong>HTML</strong> snippet that we’ve been looking at would normally reside in the body section<br />

of a <strong>com</strong>plete <strong>HTML</strong> document. An <strong>HTML</strong> document is made up of two sections: the<br />

head <strong>and</strong> the body. The body is where you put all the content that you want users to<br />

see. The head contains information about the page, most of which is invisible to the<br />

user.<br />

The body <strong>and</strong> head are always wrapped in an html element. Example 1-3 shows the<br />

snippet in the context of a proper <strong>HTML</strong> document. For now the head section contains<br />

a title element, which tells the browser what text to display in the title bar of the<br />

window.<br />

Example 1-3. A proper <strong>HTML</strong> document<br />

<br />

<br />

My Awesome Page<br />

<br />

<br />

Hi there!<br />

Thanks for visiting my web page.<br />

I hope you like it.<br />

<br />

Pizza<br />

Beer<br />

Dogs<br />

<br />

<br />

<br />

Normally, when you are using your web browser you are viewing pages that are hosted<br />

on the Internet. However, browsers are perfectly good at displaying <strong>HTML</strong> documents<br />

that are on your local machine as well. To see what I mean, crack open a text editor<br />

<strong>and</strong> type up Example 1-3. When you are done, save it to your desktop as test.html <strong>and</strong><br />

then open it <strong>with</strong> Safari by either dragging the file onto the Safari application icon or<br />

opening Safari <strong>and</strong> selecting File→Open File. Double-clicking test.html might work as<br />

well, but it could open in your text editor or another browser depending on your<br />

settings.<br />

Even if you aren’t running Mac OS X, you should use Safari when testing<br />

your <strong>iPhone</strong> web apps on a desktop web browser, because Safari is the<br />

closest desktop browser to the <strong>iPhone</strong>’s Mobile Safari. Safari for Windows<br />

is available from http://www.apple.<strong>com</strong>/safari/.<br />

Web Programming Crash Course | 5

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

Saved successfully!

Ooh no, something went wrong!