This lesson teaches you how to construct a well-formed Hyper-Text Markup Language (HTML) file. Unlike the previous exercise --which relied upon the browser's ability to accept any text, now we'll worry about the parts of the HTML file and how to construct one.
The Web page consists of an HTML file. The HTML file's content is divided into two parts (like a mammal): the head, and the body.
<html>
<!-- This is the head... -->
<head>
<title>Main Page</title>
</head>
<!-- and this is the body. -->
<body>
<p>Hello World-Wide
Web!</p>
<hr width="50%" />
</body>
</html>
The text in the comments --<!-- -->, indicates where the head and body begin. And the items looking like this: <head> or </p>, are called tags. There are two kinds of tags --and maybe a third: opening tags, like <body> or <p> and closing tags, like </title> or </html>. The third is both an opening and closing tag, like <hr width="50%" />, which stands alone.
The head contains the title of the page. That's the text contained in the solid-colored strip at the top of this window. The head can contain other, more complicated things, but for this lesson you only need be concerned about the title.
The body contains every thing else that you see on the Web page. It contains text, and images, and hyperlinks, and tables, and lists, and forms. All of which we will learn about later. (Still other things are possible on a Web page, but you'll have to learn about them yourself. For new things: look in the City Library for HTML and XHTML, the definitive guide / Chuck Musciano and Bill Kennedy. Beijing ; Sebastopol [Calif.] : O'Reilly, 2002..)
Now for the lesson: go ahead and copy the HTML code on this page onto your HTML file, index.html, the one we created last lesson, but don't need any more. Test your design, by directing your browser to it.
Notice that all the spaces and new lines are construed by the browser to be a single space in each place. Notice also that the horizontal rule, i.e. <hr />, takes up half the page as specified. Think about the difference between what the Web Page (from your HTML file) says, and what you would want it to say. --This is the hard part! Edit the HTML file, adding what you'd want your Web page to say. Don't worry about more complex things like images. We'll build on your Web page throughout the early lessons.
Now write your lesson, and have fun!