Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 3.  The Guestbook CGI Application

A Quick Introduction to HTML

Web pages are written in a text markup language called HTML (HyperText Markup Language). The idea of HTML is that you annotate, or mark up, regular text with special tags that indicate structure and formatting. For example, the title of a Web page is defined like this:

<TITLE>My Home Page</TITLE>

The tags provide general formatting guidelines, but the browsers that display HTML pages have freedom in how they display things. This keeps the markup simple. The general syntax for HTML tags is:

<tag parameters>normal text</tag>

As shown here, the tags usually come in pairs. The open tag may have some parameters, and the close tag name begins with a slash. The case of a tag is not considered, so <title>, <Title>, and <TITLE> are all valid and mean the same thing. The corresponding close tag could be </title>, </Title>, </TITLE>, or even </TiTlE>.

The <A> tag defines hypertext links that reference other pages on the Web. The hypertext links connect pages into a Web so that you can move from page to page to page and find related information. It is the flexibility of the links that make the Web so interesting. The <A> tag takes an HREF parameter that defines the destination of the link. If you wanted to link to my home page, you would put this in your page:

<A >Brent Welch</A>

When this construct appears in a Web page, your browser typically displays "Brent Welch" in blue underlined text. When you click on that text, your browser switches to the page at the address "http://www.beedub.com/". There is a lot more to HTML, of course, but this should give you a basic idea of what is going on in the examples. The following list summarizes the HTML tags that will be used in the examples:

Table 3-1. HTML tags used in the examples.
HTMLMain tag that surrounds the whole document.
HEADDelimits head section of the HTML document.
TITLEDefines the title of the page.
BODYDelimits the body section. Lets you specify page colors.
H1 - H6HTML defines 6 heading levels: H1, H2, H3, H4, H5, H6.
PStart a new paragraph.
BROne blank line.
BBold text.
IItalic text.
AUsed for hypertext links.
IMGSpecify an image.
DLDefinition list.
DTTerm clause in a definition list.
DDDefinition clause in a definition list.
ULAn unordered list.
LIA bulleted item within a list.
TABLECreate a table.
TRA table row.
TDA cell within a table row.
FORMDefines a data entry form.
INPUTA one-line entry field, checkbox, radio button, or submit button.
TEXTAREAA multiline text field.

      Previous section   Next section