218
Chapter 4
Back to that tree version of the HTML... why did the
welcome text in the <p> element get broken into more
than one text node? Wouldn’t it be easier to use just
one node, and not two or three?
When the browser gets your HTML and
represents it as a tree, the browser has to keep
up with the order of text and elements in the
markup. Otherwise, paragraphs could appear
in the wrong order on the page, and the wrong
words might be bolded or underlined.
Let’s take another look at the markup for the
welcome text:
Order matters to the web browser.
<p>
Welcome to the Webville Tree Farm. We’re still
learning about CSS, so pardon our plain site. We
just bought <a href=
”http://www.headrstlabs.com/books/hfhtml/”>
Head First HTML with CSS & XHTML</a>,
though, so expect great things soon.
</p>
Flip back to
page 213 to
see what Jenny’s
talking about.
Here’s the <p>
element that is
the parent of
all this content.
There’s quite
a bit of text
within the <p>...
...as well as an <a> element
that creates a link.
The <a> element has some
text of its own, also.
order matters