04.07.2013 Views

Start Here! Learn JavaScript - Cdn.oreilly.com

Start Here! Learn JavaScript - Cdn.oreilly.com

Start Here! Learn JavaScript - 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.

owser. The HTML to identify or mark up that content is also contained in the body. <strong>JavaScript</strong> code<br />

can also appear within the body of a webpage.<br />

After the closing tag, the page itself is closed by the closing tag that matches<br />

the tag that opened the webpage, way back up on the top. <strong>Here</strong>’s a simple example that<br />

concisely shows you what I just spent five paragraphs explaining:<br />

<br />

<br />

<br />

My Web Page<br />

<br />

<br />

My first content, in a div element<br />

<br />

<br />

Rendering this simple page in a browser results in a page similar to Figure 1-2.<br />

FIGURE 1-2 A basic webpage.<br />

More Info HTML is an expansive subject. There are countless books on the subject. This<br />

book won’t cover the underlying HTML in much detail, but all of the examples will be explained<br />

as they pertain to <strong>JavaScript</strong>. For further reading on HTML, see the book HTML5<br />

Step by Step by Faithe Wempen (Microsoft Press, 2011).<br />

CSS<br />

HTML is frequently paired with CSS to help browsers deliver a visually appealing webpage. In<br />

essence, HTML describes the function of content, while CSS is responsible for providing the look and<br />

feel of that content. CSS enables page creators to define such things as colors, backgrounds (including<br />

background images), sizes of elements, and much more. For example, by adding some CSS to the<br />

6 <strong>Start</strong> here! <strong>Learn</strong> <strong>JavaScript</strong>

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

Saved successfully!

Ooh no, something went wrong!