-->
Previous | Table of Contents | Next |
Youll find that HTML is pretty straightforward:
An HTML document typically consists of two logical sections: the head and the body. The head contains information about the document; the body contains the document information itself. As you may have guessed, the header section is enclosed with the <HEAD> and </HEAD> tags, whereas the body is enclosed with the <BODY> and </BODY> tags.
The head section of an HTML page contains information related to the document itself. You can place several tags in the header section, but the <TITLE> tag is the most widely used. The document titlewhatever is enclosed with the <TITLE> and </TITLE> tagsappears in the title bar of a Web browser.
The body section of an HTML page contains most of the elements you see when viewing the page with a Web browser. This is where you enter all the elements you want people to see, such as text, graphics, links (URLs), lists, and tables.
NOTE: The <TITLE> element identifies the name of your page. When someone makes a bookmark to the page, this is name that is used. Although HTML doesnt limit the length of the <TITLE> element, you should consider giving the page a short, descriptive title that can easily be displayed. A good rule of thumb for the length of a title is no more than a single phrase and no longer than 60 characters.Because the document title is displayed in a separate window and isnt part of the document itself, the title text itself must be plain text and not have any hyperlinks or text formatting.
TIP: One really nice thing about HTML source code is that you can look at it. Have you ever found an interesting page and wanted to know how it was done? Take a look! You can learn a lot by looking at other peoples source code.Viewing the source code is usually done through a menu choice in your Web browser. For example, to see HTML source code for a page under Netscape, choose Document Source from the View menu.
Now that youve seen the basics of HTML (yes, thats really it!), its time to learn about tags and how theyre used. Although there are many different tags, youll find that by mastering just a handful (and combining them in different ways), you can create excellent Web pages.
Basic HTML syntax consists of three components: tags, attributes, and URLs. These components, respectively, give the details of how items are to be formatted and displayed, the specifics of certain actions, and the locations of other files and documents.
The basic building blocks of HTML, tags are the part of HTML that tells a Web browser how to display text and graphics, along with other format information. As you may recall, tags are written between angle brackets (<tag_name>) and most tags also require an ending tag (</tag_name>) as well. As you may recall from Figure 32.1, you saw the <TITLE> tag used:
<TITLE>Hello Web!</TITLE>
This line tells your browser to format the text string Hello Web! as a <TITLE>. See the starting (<TITLE>) and ending (</TITLE>) tags? All of the elements within these tagstext, in this caseare displayed in the title bar of your Web browser window. Similarly, other tags only affect the elements they enclose.
Sometimes, tags need to specify exact information, such as where a file is located. Attributes are used with tags to provide more detail about how the tag is to be implemented. For example, consider the following tag:
<IMG SRC=example.gif>
This tag is an <IMG> (image) tag that tells your Web browser to display a graphic image. But which image? Thats where the attribute comes in. In this example, the attribute field is SRC=example.gif, which gives detailed information about how the <IMG> tag is to be interpreted. In this case, the example.gif file is to be displayed as the image.
TIP: Using the height and width attributes with the <IMG> tag helps your browser display the graphic more quickly. In Netscape, if the image is GIF or JPG format, you can open the image by itself. Then, from the View menu, choose View Document Info to see the size of the image.
Web resources are accessed by descriptive addresses known as uniform resource locators (URLs). Everything that you access on the Web has an URL. HTML uses URLs to specify the location of needed files or of other Web pages that are connected by hypertext links.
As youve seen, HTML breaks down into three basic components: tags, attributes, and URLs. Of these, the basic building block is the tag. Tags are used to give commands to a Web browser, whereas attributes and URLs are used to provide details about the commands.
Tags can be grouped into several categories, depending on their function. Some tags give information about the document as a whole, some are used for formatting text, and some are used for graphics and hypertext links to other documents.
ON THE WEB:
For a listing of HTML tags and their attributes, look at the online version of Ques HTML Quick Reference and Ques Special Edition Using HTML at the following addresses (respectively):
Previous | Table of Contents | Next |