3.3.2 Passing title tests

Now we’ll get our title tests to pass, and at the same time add the full
HTML structure needed to make valid web pages. The markup for a modern
web page follows this form:

<!DOCTYPE html>
<html>
  <head>
    <title>Greeting</title>
  </head>
  <body>
    <p>Hello, world!</p>
  </body>
</html>

This structure includes a document type, or doctype, declaration at the
top to tell browsers which version of HTML we’re using (in this case,
HTML5);8 a head section, in this case with “Greeting” inside a title
tag; and a body section, in this case with “Hello, world!” inside a p
(paragraph) tag. (The indentation is optional—HTML is not sensitive to
whitespace, and ignores both tabs and spaces—but it makes the document’s
structure easier to see.)

Applying this basic structure to the Home page yields Listing 3.20.