Table of Contents
- Hello World!
- Understanding Tags and Structure
- Whitespace in XHTML
- Breakdown of a Tag
- Attributes
- Paragraphs and Line Breaks
- Validation and Browser Tools
Basic Structure
Whitespace in XHTML
Lets add some more content to your simple webpage.
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?
Your First 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: " ".
The advantage is that you can use whitespace to make your code more readable, while the browser can freely adjust line breaks for each user's window and font size.
The disadvantage is that it might take you a while to get used to this behavior.
Of course, there are tags that adjust the whitespace. We'll talk about those later.
