HTML Reference Guide

© 1997 by Prentice Hall PTR

Page Layout | Paragraph Layout | Text Layout | Links | Images and Figures

Miscellaneous | Table Layout | Forms Layout | Frames Layout

JavaScript | Java

Examples

If you wish to be write HTML that conforms strictly to the standard for a particular version of HTML refer to

http://www.ozemail.com.au/~dkgsoft/html/index.html

Alternatively, if you do not care about the standard, it is suggested that before you invest heavily in the use of an HTML tag, you check its functionality, first with the Web browser(s) you use, and then with the Web browsers you anticipate being used to access your information server.

This is not a summary of all the features of HTML, Chapter Eight covers where to go for that information. Rather, it is intended as a quick reference to the major features of HTML. If you need more details in a hurry refer to the Yahoo page on HTML:

http://www.yahoo.com/Computers_and_Internet/Software/-Data_Formats/HTML/Guides_and_Tutorials/

The nomenclature used in this Appendix, which extends the conventions used throughout this book, is as follows:

<IMG ALIGN={TOP/MIDDLE/BOTTOM/LEFT/RIGHT} SRC="filename">

Curly braces {} indicate one of a number of options is permissible - in this case delimited by slashes (/). Common attributes to each tag are provided. HTML tags and their attributes are in uppercase, variables are in lowercase. Where necessary, variables are surrounded by double quotes (").


Page Layout

<BANNER> ... </BANNER> Region of text that does not scroll (browser dependent).
<BODY> ... </BODY> Main body of the document.
<DIV> ... </DIV> Standard sections of a document.
<HEAD> ... </HEAD> Document header information.
<Hn> ... </Hn> Header level where n=1-6.
<HTML> ... </HTML> Entire HTML document.
<RANGE {attributes}> Define a section of content for use by a STYLE.
<STYLE {attributes}> ... </STYLE> Impose a style.
<TITLE> ... </TITLE> Appears in the Web browser's title field.


Paragraph Layout

<BR>Line break, i.e., begin a new line.
<P>Paragraph break, as <BR> but leave a blank line.


Text Layout

<ABBREV> ... </ABBREV> An abbreviation.
<ACRONYM> ... </ACRONYM> An acronym.
<AU> ... </AU> Name of an author.
<BLOCKQUOTE> ... </BLOCKQUOTE> Text quoted from some other source; left and right margins are indented.
<B> ... </B> Bold.
<BIG> ... </BIG> Big print.
<CITE> ... </CITE> A citation.
<CODE> ... </CODE> An HTML directive.
<DEL> ... </DEL> Text deleted since a previous version of the document.
<DFN> ... </DFN> A definition.
<DIR> ... <LI> ... </DIR> Directory list of items.
<DL> ... <DT> ... <DD> ... </DL> Definition list, where <DT> is the term and <DD> the definition.
<EM> ... </EM> Emphasize text.
<FN> ... </FN> A footnote.
<I> ... </I> Italics.
<INS> ... </INS> Text inserted since a previous version.
<KBD> ... </KBD> A keyboard key.
<LANG> ... </LANG> Language.
<LH> ... </LH> The header for a list of elements.
<LISTING> ... </LISTING> Computer listing.
<MENU> ... <LI> ... </MENU> Menu of items.
<NOTE> ... </NOTE> Admonishment - a note or warning.
<OL> .. <LI> .. </OL> Ordered (numbered) lists.
<PERSON> ... </PERSON> Name of a person.
<PRE> ... </PRE> Preformatted text, i.e., text is presented literally, except hyperlinks are interpreted.
<Q> ... </Q> Quotation.
<STRIKE> ... </STRIKE> Strikethrough text.
<SAMP> ... </SAMP> Include sample output.
<SMALL> ... </SMALL> Small print.
<STRONG> ... </STRONG> Place strong emphasis.
<SUB> ... </SUB> Subscript.
<SUP> ... </SUP> Superscript.
<TAB>Force a tab.
<TT> ... </TT> Typewriter font.
<U> ... </U> Underline.
<UL> ... <LI> ... </UL> Unordered (bulleted) list.
<VAR> ... </VAR> Define a variable.
<XMP> ... </XMP> As <PRE>, but hyperlinks are ignored.


Links

<A HREF="URL">anchor_text </A> A link via anchor_text to another HTML document designated by URL.
<A NAME="anchor_name">-

anchor _text </A>

A named point in an HTML document to which other links point.
<A HREF="URL#anchor_name"> anchor_text </A> A link via anchor_text to a point #anchor_name in URL.


Images and Figures

<CAPTION> … </CAPTION> Descriptive label for a table or figure.
<CREDIT> ... </CREDIT> Credit a figure.
<IMG HEIGHT=n WIDTH=m ALIGN={TOP/MIDDLE/BOTTOM/LEFT/

RIGHT}

ALT = "image_description" SRC="URL">

Inlined image defined by URL, either a GIF or XBM, ALIGNed with respect to text, and ALT displayed in text-only browsers.
<OVERLAY>Superimpose an image on a figure.


Miscellaneous

<!-- comment_string --> Comment completely ignored by browsers, regardless of content.
<!--#command VAR="variable"--> Execute command with the associated VAR (server dependent).
<!--#INCLUDE FILE="filename"--> Include the contents of FILE (server dependent).
&ascii_equivilent; Use a character literally, e.g., &lt; for less than (<).
<ADDRESS> ... </ADDRESS> A closing address on a Web page. Has nothing to do with postal addresses.
<BASE HREF="URL"> Base part of a URL prepended to all relative URLs in the document.
<HR SIZE=n WIDTH="m%"> Insert a horizontal rule of optional thickness SIZE and covering WIDTH percent of the browser window.
<ISINDEX>Describes a database or searchable index.
<LINK REV="RELATIONSHIP" REL="RELATIONSHIP" HREF="URL"> Identifies the e-mail address of the document owner; it is not displayed in the browser.
<META attribute_value> Meta information provided between <HEAD> … </HEAD> tags, e.g., to define the expiration date of a page.


Table Layout .

<TABLE BORDER= n ALIGN={LEFT/RIGHT/CENTER/JUSTIFY

/CHAR} CELLSPACING= n

CELLPADDING= m BGCOLOR= #bbffee>

</TABLE>

Define a table with optional BORDER of thickness n. ALIGN contents in cells, leaving CELLSPACING between CELLS and CELLPADDING between text and cell edge. Optionally set the background color of the table with BGCOLOR.
<CAPTION ALIGN = {TOP/BOTTOM}> </CAPTION> Define a centered, optionally ALIGNed caption.
<TR

ALIGN={LEFT/RIGHT/CENTER/JUSTIFY

/CHAR} VALIGN = {TOP/MIDDLE/BOTTOM/BASELINE}

BGCOLOR = #bbffee>

</TR>

Define a table row, vertically aligning contents (VALIGN).
<TD COLSPAN=n ROWSPAN=m ALIGN={LEFT/RIGHT/CENTER/JUSTIFY/

CHAR} VALIGN = {TOP/MIDDLE/BOTTOM/BASELINE}

BGCOLOR = #bbffee NOWRAP>

</TD>

Define a data cell that optionally spans n columns (COLSPAN) and m rows (ROWSPAN). Optionally prevent contents from wrapping (NOWRAP).
<TH COLSPAN=n

ROWSPAN=m ALIGN={LEFT/RIGHT/CENTER/JUSTIFY/

CHAR} VALIGN = {TOP/MIDDLE/BOTTOM/BASELINE}

BGCOLOR = #bbffee NOWRAP>

</TH>

As <TD> but for column headers only.


Forms Layout

<FORM METHOD={GET/POST} ACTION="URL"> ... </FORM> Define a form for processing by URL using METHOD.
<INPUT TYPE=TEXT NAME="name" SIZE=n> A text entry box of n characters with the text associated with the variable NAME.
<INPUT TYPE=PASSWORD

NAME ="name" SIZE=n>

As TYPE=TEXT, but with the text not echoed for security reasons.
<INPUT TYPE=CHECKBOX NAME="name" VALUE={CHECKED/

NONCHECKED}>

A checked (VALUE=CHECKED) or non-checked (VALUE=NONCHECKED) checkbox.
<INPUT TYPE=RADIO NAME="name"

VALUE={CHECKED/

NONCHECKED}>

A radio button (on if VALUE=CHECKED). Radio buttons with the same NAME are grouped.
<INPUT TYPE=SUBMIT

VALUE="button_text">

Send form contents to the Web server. VALUE is the text within the button.
<INPUT TYPE=RESET

VALUE="button_text">

Clear a form of all information and reset radio buttons, checkboxes, etc. VALUE is the text within the button.
<INPUT TYPE=HIDDEN

NAME="text" VALUE="text">

Submit a hidden (i.e., not seen on the form) NAME to the server with VALUE.
<SELECT NAME="name">

<OPTION> "option_text"

<OPTION SELECTED>"option_text" </SELECT>

Pop-up menu with multiple <OPTION> tags. SELECTED defines the default <OPTION>. If SELECTED is not specified, the first <OPTION> is the default.
<SELECT NAME="name" MULTIPLE SIZE=n>

<OPTION> "option_text"

<OPTION SELECTED>"option_text" </SELECT>

Scrollable list of OPTIONs with SIZE rows displayed. MULTIPLE indicates multiple options may be selected. SELECTED defines the default selection, which may be more than one row if MULTIPLE is specified.
<TEXTAREA NAME="name" ROWS=n COLS=m> "optional_text" </TEXTAREA> Scrollable text area of n ROWS and m COLS (columns), optionally containing "optional_text".


Frames Layout

<FRAMESET COLS="n,m"

ROWS ="n,m"> …

</FRAMESET>

Defines a set of frames, within which each individual frame is defined with the <FRAME> tag. The dimensions of the area containing frames, ROWS and COLUMNS can be optionally specified.
<FRAME SRC="URL" NAME="name"

MARGINHEIGHT=n MARGINWIDTH=m

SCROLLING={YES/NO}

NORESIZE>

Display the URL in a frame of specified MARGINHEIGHT and MARGINWIDTH, with or without SCROLLING. The frame will resize to remain proportional to the overall window size unless NORESIZE is specified.
<NOFRAME> … </NOFRAME> Defines behavior in cases when the Web client recognizes the <NOFRAME> tag, but not the <FRAME> tag.
<A HREF="URL" TARGET="name"> Update the target FRAME with URL.


JavaScript

<SCRIPT LANGUAGE="JavaScript" SRC="JavaScriptCode.js"> … </SCRIPT> Block of JavaScript code. Use either the LANGUAGE or SRC attributes. LANGUAGE if the code is embedded; SRC if it is in a separate file with the extension .js.
<INPUT TYPE={BUTTON/CHECKBOX} NAME="name" ONCLICK="JavaScript function"> As the regular <INPUT> tag but with the ONCLICK attribute to define the JavaScript function to be executed.


Java

<APPLET CODE="code.class" WIDTH=n HEIGHT=m ALIGN={TEXTTOP/TOP/

ABSMIDDLE/MIDDLE/BASELINE/

ABSBOTTOM} HSPACE=n VSPACE=m CODEBASE="directory"> …

</APPLET>

Include an applet called code.class, optionally from the directory CODEBASE. Reserve a WIDTH on n pixels and a HEIGHT of m pixels for the applet on the Web page. ALIGN the applet with respect to the text on the Web page. Leave HSPACE (horizontal space) and VSPACE (vertical space) between the applet and the Web page contents.
<PARAM NAME="name" VALUE="value"> Pass the VALUE associated with NAME to an applet. The <PARAM…> tag lies between <APPLET> … </APPLET> tags.