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.

HTML5 SYNTAXES: AN EMBARRASSMENT OF RICHES

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.