Whitespace in XHTML

Lets add some more content to your simple webpage.

(source)

Your First Webpage:

<html>
<head>
<title>My First Webpage</title>
</head>
<body>
Hello World!
This is my simple webpage.
</body>
</html>

Save that in your webpage, and open it in your browser. If the page is already open, you can hit the refresh button to see the changes.

What happens?

(results)

Your First Webpage:

Hello World! This is my simple webpage.

Whoa! What happened to the line break?

XHTML ignores whitespace (spaces, tabs, or carriage returns) in the source. It replaces all continuous chunks of whitespace with a single space: " ".

Of course, there are tags that adjust the whitespace. We'll talk about those later.