04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

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.

understanding nesting by drawing<br />

To understand the nesting<br />

relationships, draw a picture<br />

Drawing the nesting of elements in a Web<br />

page is kind of like drawing a family tree. At<br />

the top you’ve got the great-grandparents,<br />

and then all their children and grandchildren<br />

below. Here’s an example...<br />

has two nested<br />

elements: and .<br />

You can call them both<br />

“children” of .<br />

is nested <strong>with</strong>in the<br />

element.<br />

110 Chapter 3<br />

is always the<br />

element at the root of<br />

the tree.<br />

head body<br />

title<br />

Simple Web page.<br />

html<br />

p<br />

q<br />

<br />

<br />

Musings<br />

<br />

<br />

<br />

To quote Buckaroo,<br />

The only reason<br />

for time is so<br />

that everything<br />

doesn’t happen<br />

at once.<br />

<br />

<br />

<br />

Let’s translate this into<br />

a diagram, where each<br />

element becomes a box, and<br />

each line connects the element<br />

to another element that is nested<br />

<strong>with</strong>in it.<br />

is nested <strong>with</strong>in the <br />

element, so we say is the “child”<br />

of .<br />

The parent of is ,<br />

the parent of is , the<br />

parent of is .

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

Saved successfully!

Ooh no, something went wrong!