Chapter 2. Creating Your First Web Page

The beauty of the HTML language is that you don't need to be a rocket scientist — or even a computer science major — to write it. Moreover, you don't need a special program to create an HTML page. Any text editor will do: the simpler, the better.

In this lesson, you gain an understanding of the basic structure common to all HTML pages. The core document you create can serve as a foundation for the most complex web page you can envision — or, as you'll see in this chapter's exercise — the most basic.


Before we proceed with the actual page code, we need to take a moment to explain the type of code that will be used in this chapter and throughout the book.

During the development of previous HTML versions, two different syntaxes were used: standard HTML and the more structured XHTML. When first created, HTML was a fairly loose language in terms of the requirements it placed on authors. For example, certain common tags, such as the paragraph tag <p>, did not require a corresponding closing element. Likewise, attribute values did not have to be enclosed in quotes; class="item" was the same as class=item. The primary benefit to standard HTML syntax was that browsers were very forgiving of coding errors which, in turn, lowered the entry barrier for beginning web page authors.

As the Web expanded in its usefulness, the drive to use the information it contained in many more situations gave rise to the XHTML syntax. ...

Get HTML5 24-Hour Trainer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.