Section 7. Set Up a Web Page s Basic HTML Structure

7. Set Up a Web Page's Basic HTML Structure


2 Use HTML Tags


6 About Proper HTML Coding

You now have a fresh, empty document in front of you. The first thing you'll need to do in order to create a web page is to set up the page's basic structure.

7. Set Up a Web Page's Basic HTML Structure

There are two basic parts of an HTML page: the head and the body.

  • The head includes information about the document itself, such as the title. (The title is what appears in the title bar of the browserit doesn't appear in the body of the page.) It also is where you can include information about your web page so that search engines such as Google can find it and index it. And the head might also include scripts that will automatically be run by visitors , such as JavaScript. The only thing in the head that will be displayed is the title. Everything else will not appear on a page.

  • The body is what contains the actual information that will be displayed by the browser. What you put there is up to youthe sky's the limit.

With that in mind, let's set up the page's basic structure.

Type the Opening Tag

Open Notepad, and at the top of the document, type in the opening HTML tag <HTML> . This tells any browser visiting your page that the document is an HTML document.

Close the Opening Tag

After you create the opening tag, press Enter a number of times, and at the bottom of the document type in the closing HTML tag </HTML> . This closes the <HTML> tag.

3 .
Create the Head Tag

Scroll back toward the top of the document, and type in the <HEAD> tag. Go down several lines, and type in the closing tag </HEAD> . You've now defined the Head of your document. For details about filling in the Head, see 8 Add a Title and Head .

Create the Body Tag

Below the </HEAD> tag, type in the opening <BODY> tag, go down several lines, and type in the closing tag </BODY> .

Save Your Document

Save your page, making sure to give it an extension of .htm or .html . If it doesn't have those extensions, it won't be recognized as a web page. Keep in mind that at this point, the document doesn't contain any contentyou'll be filling it in throughout the rest of this chapter.


The standards-setting body W3C, keeper of the official HTML flame, recommends that every web page include a special !DOCTYPE tag that alerts a browser to what version of HTML was used when coding the page. A typical such tag would be at the top of an HTML document like this:

<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN">

The truth is, there's no real need to put that in because it appears to have no effect on browsers. In fact, some of the most popular sites on the Internet, such as Yahoo! and the tech site CNet don't use that tag. If you use an HTML editing program, it may well put the tag in for you. There's no need to take it out. But if you're creating your page using a text editor or some other tool that doesn't put the tag in automatically, there's no real need to spend your time to put it in.

Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276 © 2008-2017.
If you may any questions please contact us: