In this overview of tags, I have used some simple rules to make the syntax clear. It also allows me to provide the information in a short format.
To illustrate the syntax rules, here's the section on IMG:
Appearance: | <IMG SRC=URL > |
---|---|
Attributes: | SRC=URL , ALT=string , ALIGN=left|right|top|middle|bottom, HEIGHT=n , WIDTH=n , BORDER=n , HSPACE=n , VSPACE=n , USEMAP=URL , ISMAP |
Contents: | None (Empty). |
May occur in: | BODY, H1, H2, H3, H4, H5, H6, P, LI, DT, DD, DIV, CENTER, BLOCKQUOTE, FORM, TD, TH, PRE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUP, SUB, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, IMG, FONT, APPLET, BR, SCRIPT, MAP, BASEFONT, INPUT, SELECT, TEXTAREA and plain text. |
The first section, Appearance, gives a common way to use this tag. As you can see here, the IMG tag does not have an ending tag. If the beginning or ending tag appears inside square brackets, it is optional and may be left off.
The next section describes the attributes for the IMG tag. If an attribute appears in bold, it is required, otherwise it may be omitted. In the above case, SRC is required, but the other attributes are not. Note that the attributes themselves are listed in all caps, and the possible values (if possible) in lower case. Note that an attribute value must be quoted if it contains more than just letters, digits, hyphens and periods.
The contents section describes which tags are permitted inside this tag. For IMG, there are none. And last, you can see which tags allow IMG inside them.
The attributes and their values are noted in a very compact format as
well. The "|" character is used to separate mutually exclusive
attributes or values. For example, A=foo|bar
indicates
that attribute "A" may get foo or bar as value, but not both, or
anything else. A=
indicates
that you may use either A or B, but not both.
string
|B=string
If an attribute can take more possible values than can be given in a list, the following special symbols are used:
n
p%
URL
string
#RRGGBB
Appearance: | <ADDRESS> </ADDRESS> |
---|---|
Attributes: | None. |
Contents: | P, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The ADDRESS tag should be used to enclose contact information, addresses and the likes. It is often rendered with a slightly indented left margin and italics.
Appearance: | <APPLET CODE=string HEIGHT=n WIDTH=n > </APPLET> |
---|---|
Attributes: | CODEBASE=URL , CODE=string , NAME=string , ALT=string , ALIGN=left|right|top|middle|bottom, HEIGHT=n , WIDTH=n , HSPACE=n , VSPACE=n |
Contents: | PARAM and TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The APPLET tag is used to include Java applets. The CODE attribute indicates the location of the class of the applet itself. CODEBASE can be used to specify an absolute URL for the applet, similar to the BASE element for HTML documents. Other classes for this applet will be searched at the location indicated in CODEBASE. If this is not specified, the current URL will be used for the location. The NAME attribute gives the name of the applet.
Just like with IMG, WIDTH and HEIGHT are used to specify the width and height of the applet's window, and HSPACE and VSPACE control horizontal and vertical spacing around the applet. ALIGN sets the horizontal or vertical alignment for the applet.
Arguments to the applet can be specified with the PARAM tag, which goes inside the APPLET tag.
The ALT text may contain text which should be displayed if the applet cannot be run, but you should use the contents of APPLET instead. In here you may use markup, so you can provide a better alternative than with the ALT text.
Appearance: | <AREA SHAPE=x HREF=URL COORDS=string ALT=string > |
---|---|
Attributes: | SHAPE=rect|circle|poly|default, COORDS=string , NOHREF|HREF=URL , ALT=string |
Contents: | None (Empty). |
May occur in: | MAP. |
Inside the MAP tag, each "hotzone" in the client-side imagemap is defined with an AREA tag. The HREF attribute specifies the URL for the destination that should be chosen if this area was selected. If you specify NOHREF instead, this area won't do anything.
SHAPE and COORDS define the actual region. SHAPE can be a rectangle, circle, or polygon, and COORDS should contain a set of coordinates describing that shape. This is done with a comma separated list of numbers, enclosed in quotes. If SHAPE is set to DEFAULT, no coordinates need to be specified. The default area is what will be chosen if no others match. The syntax for COORDS depends on what shape you choose.
<AREA SHAPE=rect COORDS="0,0,9,9">
would specify
a rectangle of 10x10 pixels, starting in the top left corner of the image.
<AREA SHAPE=circle
COORDS="10,10,5">
would specify a circle with radius 5 at
location (10,10) in the image.
<AREA SHAPE=poly COORDS="10,50,15,20,20,50">
would specify a triangle, with edge locations (10,50), (15,20) and (20,50).
The ALT text is used by text browsers to present the URLs in the imagemap in a more readable fashion. If you leave those off, the browser can only display the "bare" URLs. The ALT text is required if you want your document to be valid.
Appearance: | <A HREF=URL > </A> |
---|---|
Attributes: | HREF=URL , NAME=string , REL=string , REV=string , TITLE=string |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The anchor tag is the "glue" for hypertext documents. The enclosed text and/or image(s) will be selectable by the user, and doing so will take the user to the location specified in the HREF attribute. The TITLE attribute can be used to provide a description of that location, which is displayed by some browsers when the mouse moves over the URL.
The NAME attribute is used to set up "named anchors." The enclosed text will be marked as a "target" to which a browser can jump directly. For example, if you have "<A NAME="toc">Table of Contents</A>" somewhere in the document, and the user selects the URL "#toc" he will be taken to that line.
REL and REV are not widely used, although these attributes were already present in the HTML 2.0 specs. They are used to mark up relationships between the current document and the resource in the link. REL="foo" in document A, in a link pointing to B, indicates that document A has a relationship of "foo" with document B. REV="foo" indicates B has that relationship with A. Since these attributes are not widely used, there is no standard list of values for REL and REV.
Appearance: | <BASEFONT SIZE=n > |
---|---|
Attributes: | SIZE=n |
Contents: | None (Empty). |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The BASEFONT tag is used to suggest a default font size. FONT tags using a relative font size will use the value set here. The SIZE attribute is an integer value ranging from 1 to 7. The base font size applies to the normal and preformatted text but not to headings, except where these are modified using the FONT element with a relative font size.
Appearance: | <BASE HREF=URL > |
---|---|
Attributes: | HREF=URL |
Contents: | None (Empty). |
May occur in: | HEAD. |
The BASE tag is used to indicate the correct location of the document. Normally, the browser already knows this location. But in cases such as a mirrored site, the URL used to get the document is not the one that should be used when resolving relative URLs. That's when you use the BASE tag. The required HREF attribute must contain a full URL which lists the real location of the document.
For example, in a document which contains
<BASE HREF="http://www.htmlhelp.com/">
,
the relative URL in <IMG SRC="icon/wdglogo.gif">
corresponds with the full URL http://www.htmlhelp.com/icon/wdglogo.gif.
Appearance: | <BIG> </BIG> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The BIG tag (as well as SMALL) is new. A browser should draw the enclosed text in a larger font if available, and ignore the tag otherwise. Since this tag is new, support for it is not universal. The FONT tag can do the same, with SIZE="+1".
Appearance: | <BLOCKQUOTE> </BLOCKQUOTE> |
---|---|
Attributes: | None. |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
If you are quoting more than a few lines from a document, use a BLOCKQUOTE to indicate this. Block quotations are often rendered with indented margins, and possibly in italics, although a rendering with the standard quotation symbol for E-mail, "> ", is of course also possible.
Appearance: | [<BODY>] [</BODY>] |
---|---|
Attributes: | BACKGROUND=URL , BGCOLOR=#RRGGBB , TEXT=#RRGGBB , LINK=#RRGGBB , VLINK=#RRGGBB , ALINK=#RRGGBB |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | HTML. |
The BODY tag contains the actual contents of the document. That contents should consist of block elements only. You may put in plain text in the body, this is then assumed to be inside a P container.
The attributes contain the appearance of the document. The BACKGROUND attribute should point to the location of an image, which is used as the (tiled) background of the document. The other attributes set the colors for the background, text, links, visited links and active (currently being selected) links, using the order above.
The color is composed
by specifying the red, green and blue components of the color in
hexadecimal notation, with a # in front. For example, to specify white,
the red, green and blue components are 255, 255, 255, so you would
use "#FFFFFF". You can also use the following color names, although
they are not as widely supported as the codes:
Black: | #000000 | Green: | #008000 | Silver: | #C0C0C0 | Lime: | #00FF00 |
---|---|---|---|---|---|---|---|
Gray: | #808080 | Olive: | #808000 | White: | #FFFFFF | Yellow: | #FFFF00 |
Maroon: | #800000 | Navy: | #000080 | Red: | #FF0000 | Blue: | #0000FF |
Purple: | #800080 | Teal: | #008080 | Fuchsia: | #FF00FF | Aqua: | #00FFFF |
The BODY tag is optional; if you put all the HEAD elements first, the browser can immediately see where the actual document body begins.
Appearance: | <BR> |
---|---|
Attributes: | CLEAR=left|all|right|none |
Contents: | None (Empty). |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The BR tag is used to force line breaks within text. Normally, linebreaks are treated as a space by browsers (except inside the PRE tag). The optional CLEAR attribute is used when you have an IMG image in your text. If that image uses ALIGN=LEFT or ALIGN=RIGHT, the text will flow around it. If you have text you want below the image, you can do this with <BR CLEAR=LEFT> or CLEAR=RIGHT to force scrolling down to a clear left or right margin, respectively. Using CLEAR=ALL will scroll down until both margins are clear. CLEAR=NONE is the default, and does nothing.
Appearance: | <B> </B> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
B is used to indicate that the enclosed text must be rendered in a bold typeface. It must be rendered distinct from I-italics text.
If you want to indicate strong emphasis, use the STRONG element instead. B should only be used when you want bold typeface for some other reason than to denote strong emphasis. While the two tags usually produce the same output, the B tag does not provide any reasons why the enclosed text is in boldface. This means an indexer or text-only browser cannot pick a good alternative. With STRONG this is possible.
Appearance: | <CAPTION> </CAPTION> |
---|---|
Attributes: | ALIGN=top|bottom |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | TABLE. |
The CAPTION tag is used to provide a caption for a TABLE. This caption can either appear above or below the table. This can be indicated with the ALIGN attribute. It is usually centered with respect to the table itself, and usually appears in bold or is emphasized in some other way.
The tag should appear directly below the TABLE tag, before the first TR.
Appearance: | <CENTER> </CENTER> |
---|---|
Attributes: | None. |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The CENTER tag is one of the first Netscape extensions. It is used to indicate that large blocks of text should appear centered. In the Wilbur standard, it is defined as an alias for <DIV ALIGN=CENTER>.
The tag is more widely supported than the DIV method, as it was the first widely implemented Netscape extension to HTML 2.
Appearance: | <CITE> </CITE> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The CITE element marks up the title of a cited work.
For example, a text discussing HTML could say <CITE>RFC
1866</CITE> says ...
.
Text in CITE is typically rendered in italics.
Appearance: | <CODE> </CODE> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
CODE is used for snippets of code which appear inside a paragraph of
text. It is usually rendered in a monospaced font. You can use this
tag to mark up things like <CODE>for ( ; ; ) ;</CODE>
is a nice way to make an endless loop in C
.
For larger blocks of code, use PRE instead. If what you are marking up is what a user should type in, use KBD.
Appearance: | <DD> [</DD>] |
---|---|
Attributes: | None. |
Contents: | P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE and TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | DL. |
The DD tag is used inside a DL definition list to provide the definition of the text in the DT tag. It may contain block elements but also plain text and markup. The end tag is optional, as it's always clear from the context where the tag's contents ends.
A typical rendering is indented, one line below the DT, but this is not guaranteed.
Appearance: | <DFN> </DFN> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
DFN is used to mark up terms which are used for the first time. These are often rendered in italics so the user can see this is where the term is used for the first time.
Appearance: | <DIR> </DIR> |
---|---|
Attributes: | COMPACT |
Contents: | LI. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The DIR element is similar to the UL element. It represents a list of short items, typically up to 20 characters each. Items in a directory list may be arranged in columns, typically 24 characters wide.
Appearance: | <DIV ALIGN=foo> </DIV> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The DIV tag is used to mark up divisions in a document. It can enclose paragraphs, headers and other block elements. Currently, you can only use it to set the default alignment for all enclosed block elements. Future standards will most likely include more options for DIV.
Just like with other block elements such as P or H1, you can specify left, right and centered alignment.
Appearance: | <DL> </DL> |
---|---|
Attributes: | COMPACT |
Contents: | DT, DD. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
DL is used to provide a list of items with associated definitions. Every item should be put in a DT, and its definition goes in the DD directly following it. This list is typically rendered without bullets of any kind.
While it is legal to have a DL with only DD or DT tags, it doesn't make much sense (what good is a definition without a term?) and you shouldn't expect it to get rendered as a normal list.
Appearance: | <DT> [</DT>] |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | DL. |
The DT tag is used inside DL. It marks up a term whose definition is provide by the next DD. The DT tag may only contain text-level markup.
Appearance: | <EM> </EM> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
EM is used to indicate emphasized text. While it is often rendered identical to I, italics, using EM rather than I is preferred. It allows the browser to distinguish between emphasized text and other text which can be drawn in italics (for example citations, CITE).
EM text should be rendered distinct from STRONG text.
Appearance: | <FONT> </FONT> |
---|---|
Attributes: | SIZE=string , COLOR=#RRGGBB |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The FONT tag can be used to change the appearance of the current block, in terms of size and color. The SIZE attribute can either take an absolute value, ranging from 1 (smallest) to 7 (largest), or a relative value. Using the latter will change the font relative to the font size as set in the most recent BASEFONT tag. For example, <FONT SIZE="+1"> will make the font size one step bigger.
The COLOR attribute takes a hex value, which is the RGB-notation of the desired color. You can also use a color name, although the names are less widely supported than the codes. See the section on BODY for a more detailed explanation on how to specify colors.
In both cases, the closing tag </FONT> restores the previous font size and/or color.
Appearance: | <FORM ACTION=URL > </FORM> |
---|---|
Attributes: | ACTION=URL , METHOD=get|post, ENCTYPE=string |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
Forms allow a person to send data to the WWW server. You can use the INPUT, TEXTAREA and SELECT tags to add individual elements, such as checkboxes, input fields or "drop down" lists to your form. A form may contain all markup (both text and body level tags), but it may not have a nested form.
FORM has one required attribute, ACTION, specifying the URL of a CGI script which processes the form and sends back feedback. There are two methods to send form data to a server. GET, the default, will send the form input in an URL, whereas POST sends it in the body of the submission. The latter method means you can send larger amounts of data, and that the URL of the form results doesn't show the encoded form.
You can specify an encoding type with ENCTYPE, the default of "application/x-www-form-urlencoded" is most widely supported. An alternative is "text/plain", which is typically used in combination when the ACTION attribute points to a mailto: URL. If a browser supports both, the contents of the form is sent in plain text to the indicated recipient.
<FORM ACTION="destination_url" METHOD=GET> <INPUT TYPE=submit NAME=foo VALUE="Go to destination"> </FORM>
Appearance: | <H1> </H1> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 1 heading is the most important header in the document. It should be rendered more prominently than any other header. It is usually used to indicate the title of the document. Often it has the same contents as the TITLE, although this is not required and not always a good idea. The title should be useful out of context (for example, in a bookmarks file) but the level 1 heading is only used inside the document.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | <H2> </H2> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 2 heading is the second most important header in the document. It should be rendered more prominently than a H3, but less prominently than a H1. It is often used to mark up chapters in a document.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | <H3> </H3> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 3 heading is the third most important header in the document. It should be rendered more prominently than a H4, but less prominently than a H2. It is often used to mark up sections inside a chapter in a document.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | <H4> </H4> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 4 heading should be rendered more prominently than a H5, but less prominently than a H3. It is often used to mark up subsections in a document.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | <H5> </H5> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 5 heading is the second least important header in the document. It should be rendered more prominently than a H6, but less prominently than a H4. Because it is often rendered in a small font, it is not used very often. It should be used to divide sections inside a H4.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | <H6> </H6> |
---|---|
Attributes: | ALIGN=left|right|center |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD. |
The level 6 heading is the least important header in the document. It should be rendered less prominently than a H5, but more prominently than normal text. Because it is often rendered in a small font, it is not used very often. It should be used to divide sections inside a H5.
The optional ALIGN attribute controls the horizontal alignment of the header. It can be LEFT, CENTER or RIGHT.
Appearance: | [<HEAD>] [</HEAD>] |
---|---|
Attributes: | None. |
Contents: | TITLE, ISINDEX, BASE, SCRIPT, STYLE, META, LINK. |
May occur in: | HTML. |
The HEAD part of the document provides information about the document. It should not contain text or normal markup. If a browser encounters such markup, it will assume it has arrived in the BODY section of the document already.
Appearance: | <HR> |
---|---|
Attributes: | ALIGN=left|right|center, NOSHADE, SIZE=n , WIDTH=n |p% |
Contents: | None (Empty). |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
HR is used to draw horizontal rules across the browser window. If the margins are currently smaller, for example because of images (IMG) which are placed against the margins, the rule will extend to these margins instead of the whole window. A horizontal rule is typically used to separate sections within a document.
In HTML 3.2, the appearance can be controlled more than in HTML 2. You can specify the thickness of the rule with the SIZE attribute, which takes an integer number of pixels. The width of the rule can be specified in number of pixels or as a percentage of the currently available window width, using the WIDTH attribute. Don't forget that percentage values must be quoted! The NOSHADE attribute is used to indicate that the rule should not get its usual shaded appearance, but instead should be drawn as a thick line.
Appearance: | [<HTML>] [</HTML>] |
---|---|
Attributes: | VERSION=string |
Contents: | HEAD followed by BODY. |
May occur in: | (Not appliciable). |
The HTML tag is the outermost tag. It is not required and may safely be omitted. It indicates that the text is HTML (the version can be indicated with the optional VERSION attribute), but this information is almost never used by servers or browsers.
Appearance: | <IMG SRC=URL > |
---|---|
Attributes: | SRC=URL , ALT=string , ALIGN=left|right|top|middle|bottom, HEIGHT=n , WIDTH=n , BORDER=n , HSPACE=n , VSPACE=n , USEMAP=URL , ISMAP |
Contents: | None (Empty). |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The IMG tag is used to insert images within text. These are often called "inline" images. Note that the IMG tag is not a block tag by itself, so it must be used only within a block element. The location of the image file should be specified in the SRC attribute. It can be a relative or an absolute URL. When the image cannot be displayed for whatever reason, the browser should display the ALT text instead. The WIDTH and HEIGHT attributes should contain the image's dimensions. This allows a browser to lay out the page in advance, as it now knows where the text below the image should be drawn.
ALIGN controls the alignment of the image with respect to the text. Using a value of LEFT or RIGHT will make the image line up against the left or right margin, and text will flow around it. To force text below such an aligned image, use BR with the CLEAR attribute. The values TOP, MIDDLE and BOTTOM specify where any text following the image should be put. If more than one line follows after the image, it will be put below the image.
VSPACE and HSPACE get a numeric value, indicating the number of pixels that should be left free around the image. VSPACE covers vertical spacing and HSPACE the horizontal spacing.
The BORDER attribute is used when the image is a link. It indicates that the browser should draw a border of the indicated size around the image to show that it is a link. It's most often used as BORDER=0 to turn it off. This has the disadvantage that the image must make it very clear that it's a hyperlink.
ISMAP and USEMAP are used for imagemaps. The ISMAP attribute specifies that the link that this image is in goes to an imagemap program on the server, so the browser can send the coordinates of the selected location to the server. USEMAP is used for a so-called client-side imagemap. It specifies the URL of the imagemap information. Support for this is limited, especially if the URL points to a different document rather than an inline anchor. See the section on the MAP tag for more information about client-side imagemaps.
Appearance: | <INPUT TYPE=x NAME=y> |
---|---|
Attributes: | TYPE=text|password|checkbox|radio|submit|reset|file|hidden|image, NAME=string , VALUE=string , CHECKED, SIZE=n , MAXLENGTH=n , SRC=URL , ALIGN=top|middle|bottom|left|right |
Contents: | None (Empty). |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION, but must be inside a FORM. |
The INPUT tag is probably the most useful tag inside forms. It can generate buttons, input fields and checkboxes. In all cases, the NAME attribute must be set.
n
&NAME.y=n
". A text browser will treat it as
identical to a normal submit button.
Appearance: | <ISINDEX> |
---|---|
Attributes: | PROMPT=string . |
Contents: | None (Empty). |
May occur in: | HEAD. |
The ISINDEX tag was used before FORMs became more popular. When inserted in a document, it will allow the user to enter keywords which are then sent to the server. The server then executes a search and returns the results. The PROMPT attribute can be used to override the default text in the dialog box ("Enter search keywords: ").
Appearance: | <I> </I> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
I is used to indicate that the enclosed text must be rendered in a italic (slanted) typeface. It must be rendered distinct from B-bold text.
You should use EM or CITE instead of I if you can. While they usually produce the same output, the I tag does not provide any reasons why the enclosed text is in italics. This means an indexer or text-only browser cannot pick a good alternative. With EM and CITE this is possible. The browser can now distinguish between emphasized text and citations and choose different methods to display them.
Appearance: | <KBD> </KBD> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
KBD is used to indicate text which should be entered by the user. It is often drawn in a monospaced font, although this is not required. It differs from CODE in that CODE indicates code fragments and KBD indicates input.
Appearance: | <LINK REL=string HREF=URL > |
---|---|
Attributes: | REL=string , REV=string , HREF=URL , TITLE=string |
Contents: | None (Empty). |
May occur in: | HEAD. |
LINK is used to indicate relationships between documents. There are two possible relationships: REL indicates a normal relationship to the document specified in the URL. REV indicates a reverse relationship. In other words, the other document has the indicated relationship with this one. The TITLE attribute can be used to suggest a title for the referenced URL or relation.
Some possible values for REL and REV:
Appearance: | <LI> [</LI>] |
---|---|
Attributes: | TYPE=disc|square|circle when in UL, TYPE=1|a|A|i|I when in OL, VALUE=n |
Contents: | P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE and TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | UL, OL, DIR, MENU. |
The LI element is used to mark list items within a list. When the list used is OL, ordered list, the LI element will be rendered with a number. The appearance of that number can be controlled with the TYPE attribute. Similarly, inside an unordered list UL the type of bullet that is displayed can be controlled with TYPE. DIR and MENU can't be controlled this way, as they are not required to be bulleted or numbered. For ordered lists, you can also reset the sequence with the VALUE attribute.
The TYPEs for ordered lists should give the following appearance:
Appearance: | <MAP NAME=string > </MAP> |
---|---|
Attributes: | NAME=string |
Contents: | AREA. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
When you use a client-side imagemap, the information on the "hot spots" (clickable areas) in the image is defined here. Every selectable area should be mentioned in an AREA tag inside the MAP tag. The NAME attribute on the MAP tag assigns a name to the imagemap. The URL for the client-side imagemap should point to this.
For example, if you have a map named "foo", you could reference to it
with <IMG SRC="map.gif" USEMAP="#foo">
if the image was on the same page.
Appearance: | <MENU> </MENU> |
---|---|
Attributes: | COMPACT |
Contents: | LI. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The MENU item produces a list like UL, but it should be rendered more compact. Not all browsers make this distinction, and some render it without a bullet at all.
Appearance: | <META NAME=string CONTENT=string > |
---|---|
Attributes: | HTTP-EQUIV=string |NAME=string , CONTENT=string |
Contents: | None (Empty). |
May occur in: | HEAD. |
The META tag is used to convey meta-information about the document, but can also be used to specify headers for the document. You can use either HTTP-EQUIV or NAME to name the meta-information, but CONTENT must be used in both cases. By using HTTP-EQUIV, a server should use the name indicated as a header, with the specified CONTENT as its value. For example,
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT"> <META HTTP-EQUIV="Keywords" CONTENT="Nanotechnology, Biochemistry"> <META HTTP-EQUIV="Reply-to" CONTENT="dsr@w3.org (Dave Raggett)">
The server should include the following response headers when the document is requested:
Expires: Tue, 04 Dec 1993 21:29:02 GMT Keywords: Nanotechnology, Biochemistry Reply-to: dsr@w3.org (Dave Raggett)
Popular uses for META include:
Appearance: | <OL> </OL> |
---|---|
Attributes: | TYPE=1|a|A|i|I, START=n , COMPACT |
Contents: | LI |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The OL tag marks up an ordered list of items. Each item should be marked up with a LI, and it will be displayed with a number in front of it. The appearance of the number can be controlled with the TYPE attribute:
The START attribute indicates where the list should start. The COMPACT attribute indicates that the list contains only short list items, so it may be rendered in a more compact way. This is currently not widely supported.
Appearance: | <OPTION> [</OPTION>] |
---|---|
Attributes: | VALUE=string , SELECTED |
Contents: | Plain text. |
May occur in: | SELECT. |
The OPTION tag is used inside a SELECT selection list to indicate an option. You may not use markup in an option. All options listed will be displayed in a list or drop-down box, and the user can select one or more from the list. The VALUE of each option should be unique.
If you specify the SELECTED attribute, this option will appear selected when the form comes up initially.
Appearance: | <PARAM NAME=x VALUE=y> |
---|---|
Attributes: | NAME=string VALUE=string |
Contents: | None (Empty). |
May occur in: | APPLET. |
The PARAM element is used to provide "command-line" arguments to a Java applet, which is embedded in a document with the APPLET element. It has two attributes: NAME specifies the name of the argument, and VALUE specifies the value for this argument.
Appearance: | <PRE> </PRE> |
---|---|
Attributes: | WIDTH=n |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
PRE is used to include sections of text in which formatting is critical. Unlike in the other HTML containers, text in a PRE pair will only be wrapped at the linebreaks in the source, and spaces will not be collapsed. You can even use tabs, although it is better to use multiple spaces since those will always be the right number.
Text inside this tag will be displayed in a monospaced font to retain the formatting. This is the reason you cannot include font-changing tags inside PRE text. Images are excluded because they can introduce problems with alignment. An image can't be translated to a certain number of characters.
The optional WIDTH attribute can be used to indicate how wide the text is (for example, WIDTH=80 for a typical text file). This would allow the browser to pick a font which fits the entire text in the current window. Unfortunately this isn't very widely supported.
Appearance: | <P> [</P>] |
---|---|
Attributes: | ALIGN=left|center|right |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI, ADDRESS. |
The P tag is used to indicate paragraphs. The optional attribute ALIGN indicates the preferred alignment for the contents of this paragraph. Support for ALIGN=RIGHT is not as large as support for the other two. Note that ALIGN=LEFT is the default.
Appearance: | <SAMP> </SAMP> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
SAMP is used to indicate a sample of text which should be used literally. For example, "The text <SAMP>General Protection Fault</SAMP> is well known to Windows users."
It differs from KBD text in that KBD text indicates text the user must enter, whereas SAMP text can also be output.
Appearance: | <SCRIPT> </SCRIPT> |
---|---|
Attributes: | None. |
Contents: | Plain text, but should be a valid script. |
May occur in: | HEAD. |
The SCRIPT tag is included only to ensure upward compatibility. Newer versions of HTML will include support for inline scripts, which should be contained in this tag. The tag should contain a valid script.
Note that current browsers are only required to hide the contents of the SCRIPT tag, it does not have to use the information contained therein.
In the meantime, if you need scripts in your documents, put them inside HTML comments.
Appearance: | <SELECT NAME=string > </SELECT> |
---|---|
Attributes: | NAME=string , SIZE=n , MULTIPLE |
Contents: | OPTION. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION, but must be inside a FORM. |
The SELECT tag is used inside forms to generate a list of items from which the user can select one or more. Each item is listed in an OPTION tag. The value of the selected OPTION tag is assigned to the NAME of the SELECT tag, and both are sent to the server when the form is submitted.
The SIZE attribute indicates how many items are visible at once. If set to one, you will get a drop-down list. If it's more than one, you will get a scrollable list. If the MULTIPLE attribute is selected, the user can select more than one item from the list.
Appearance: | <SMALL> </SMALL> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The SMALL tag (as well as BIG) is new. A browser should draw the enclosed text in a smaller font if available, and ignore the tag otherwise. Since this tag is new, support for it is not universal. The FONT tag can do the same, with SIZE="-1".
Appearance: | <STRIKE> </STRIKE> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The STRIKE tag specifies that the enclosed text should be rendered in a strike-through appearance. Usually this is done with a line through the middle of the text.
Appearance: | <STRONG> </STRONG> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
STRONG is used to indicate strongly emphasized text. While it is often rendered identical to B, boldface, using STRONG rather than B is preferred. It allows the browser to distinguish between strongly emphasized text and other text which must be drawn in boldface in the case where boldface is not available.
STRONG text should be rendered distinct from EM text.
Appearance: | <STYLE> </STYLE> |
---|---|
Attributes: | TYPE=string |
Contents: | Plain text, but should be valid style markup. |
May occur in: | HEAD. |
The STYLE tag is included only to ensure upward compatibility. Newer versions of HTML will include support for style sheets, and this tag can be used to provide "in-line" style information. The tag should contain only valid style statements, in the language indicated in the TYPE attribute.
Note that current browsers are only required to hide the contents of the STYLE tag, it does not have to use the information contained therein.
Appearance: | <SUB> </SUB> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
SUB specifies that the enclosed text should be rendered in subscript, with the enclosed text slightly lower than the surrounding text. This can be useful for mathematical formulas.
Appearance: | <SUP> </SUP> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
SUP specifies that the enclosed text should be rendered in superscript, with the enclosed text slightly higher than the surrounding text. This can be useful for mathematical formulas.
Appearance: | <TABLE> </TABLE> |
---|---|
Attributes: | ALIGN=left|center|right, WIDTH=n |p% , BORDER=n , CELLSPACING=n , CELLPADDING=n |
Contents: | One CAPTION, TR. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
Table start with an optional caption followed by one or more rows. Each row consists of one or more cells, which can be either header or data cells. Cells can overlap across rows and columns.
The ALIGN attribute controls the alignment of the table itself, but not of the individual cells. This can be set either in the TR element for an entire row, or in the TD and TH elements for individual cells. The WIDTH attribute can be a pixel width or a percentage. It indicates the suggested width of the table, although the browser can ignore this if it is not possible. A "100%" value means the table will span across the entire browser window.
You can specify the width of the border around the table with the BORDER attribute. This attribute only affects the width of that border, not of the lines between table cells. If the attribute is omitted, no border will be drawn.
However, you can increase the whitespace inside a table. The CELLPADDING attribute indicates how many pixels there should be between a cell's contents and the border. CELLSPACING indicates how much whitespace (in pixels) there should be between individual cells.
As an example, here is a table from the HTML 3.0 draft:
<TABLE BORDER=1> <CAPTION>A test table with merged cells</CAPTION> <TR><TH ROWSPAN=2><TH COLSPAN=2>Average <TH ROWSPAN=2>other<BR>category<TH>Misc <TR><TH>height<TH>weight <TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003 <TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002 </TABLE>
This could appear as follows, in a text browser:
A test table with merged cells /--------------------------------------------------\ | | Average | other | Misc | | |-------------------| category |--------| | | height | weight | | | |-----------------------------------------|--------| | males | 1.9 | 0.003 | | | |-----------------------------------------|--------| | females | 1.7 | 0.002 | | | \--------------------------------------------------/
Appearance: | <TD> [</TD>] |
---|---|
Attributes: | ROWSPAN=n , COLSPAN=n , NOWRAP, ALIGN=left|right|center, VALIGN=top|middle|bottom, WIDTH=n , HEIGHT=n |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | TR. |
The TD tag is used to mark up individual cells inside a table row. It may contain almost all tags, including nested tables. If the cell is a label of some sort, use TH instead of TD.
The NOWRAP attribute indicates the contents of the current cell should not be wrapped. You must use BR in the cell to force line breaks to prevent the entire cell from showing up as just one line.
The ROWSPAN and COLSPAN attributes indicate how many rows or columns this cell overlaps. If you use these attributes, make sure you count correctly or you can get some very weird results.
The ALIGN and VALIGN attributes control the horizontal and vertical alignment of the current cell. ALIGN can be set for left, right or centered cells. VALIGN indicates that the table cell's contents should appear at the top, the middle or the bottom of the row. Note that align and valign attributes for a cell override the values set for the row.
The WIDTH and HEIGHT attributes can be used to suggest a width and height for this cell. This should be a value in pixels. Setting different widths for multiple cells in the same column, or different heights for multiple cells in one row can cause unexpected effects.
For an example on how to construct tables, please see the section on the TABLE tag.
Appearance: | <TEXTAREA NAME=string , ROWS=n , COLS=n > </TEXTAREA> |
---|---|
Attributes: | NAME=string , ROWS=n , COLS=n |
Contents: | Plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION, but must be inside a FORM. |
The TEXTAREA tag, used inside FORMs, sets up an area in which the user can type text. This text will be sent to the server when the form is submitted. The user can enter more than one line (as opposed to <INPUT TYPE=text> which only permits one line), although he will have to break lines himself.
The NAME attribute assigns the text area a name, used by the script which processes the form. ROWS and COLS are used to specify the height and width of the text area, in number of characters.
To supply default text for the text area, put it inside the TEXTAREA tag. You may not use markup for this default value.
Appearance: | <TH> [</TH>] |
---|---|
Attributes: | ROWSPAN=n , COLSPAN=n , NOWRAP, ALIGN=left|right|center, VALIGN=top|middle|bottom, WIDTH=n , HEIGHT=n |
Contents: | H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR, TABLE, ADDRESS as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | TR. |
Like the TD tag, a TH is used for a table cell. However, TH should be used when the cell's contents is a heading of some sort, for example, when the text is a label for a row of column.
See the section on TD for an explanation of the various attributes.
For an example on how to construct tables, please see the section on the TABLE tag.
Appearance: | <TITLE> </TITLE> |
---|---|
Attributes: | None. |
Contents: | Plain text. |
May occur in: | HEAD. |
Each document must have exactly one TITLE element. This element provides the title of the document. It is usually displayed at the top of the browser's window, but also used to label a bookmark entry for the document and as a caption in search engine results.
It may only contain text and entities, but no markup.
Appearance: | <TR> [</TR>] |
---|---|
Attributes: | ALIGN=left|right|center, VALIGN=top|middle|bottom |
Contents: | TH, TD. |
May occur in: | TABLE. |
HTML tables are constructed as a sequence of rows. Each row of table cells should be enclosed in a TR tag. The end tag is optional, since it is usually obvious to see where a row ends - where the new row begins, or where the entire table ends.
The ALIGN and VALIGN attributes control the horizontal and vertical alignment of the entire row. ALIGN can be set for left, right or centered cells. VALIGN indicates that the table cell's contents should appear at the top, the middle or the bottom of the row.
For an example on how to construct tables, please see the section on the TABLE tag.
Appearance: | <TT> </TT> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
The TT tag specifies that the enclosed text should be rendered in a teletype (monospaced) font. This can be used to simulate typewriter output. If possible, use CODE, SAMP or KBD instead. These tags allow the browser to pick a suitable rendering for each specific case, instead of the generic rendering you get with TT. It also makes the job easier for convertors and search robots.
Appearance: | <UL> </UL> |
---|---|
Attributes: | TYPE=disc|square|circle, COMPACT |
Contents: | LI. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD and DD, LI. |
The UL element indicates an unordered list. Every item in a list is marked with LI, and usually appears with a bullet of some sort in front of it. If you need numbering, use OL for an ordered list.
The type of bullet can be suggested with the TYPE attribute. You have three possible styles: "disc" for a closed bullet, "square" for an open square and "circle" for an open bullet. The COMPACT attribute is used to indicate that the list items are short, so the browser can render the list more compact. For example, it could put more than one item on a line.
Appearance: | <U> </U> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
U is used to indicate the enclosed text should be underlined. As most browsers use underlining to indicate hyperlinks, try to avoid this tag. It can confuse your users if they see "hyperlinks" that do not work.
Underlining is an alternative rendering for italic text (for example, on typewriters). Since HTML has an I tag for italics, use that if this is what you are using U for.
Appearance: | <VAR> </VAR> |
---|---|
Attributes: | None. |
Contents: | TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT, SELECT, TEXTAREA and plain text. |
May occur in: | BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION. |
VAR is used to mark up variables, for example in discussions of computer programs. Using this tag allows programs to automatically generate lists of the used variables. Example: "The variable <VAR>c</VAR> is used as a counter in this program."
HTML 3.2 Reference ~ Elements by Function ~ Elements Alphabetically
Home, Forums, Reference, Tools, FAQs, Articles, Design, Links
Copyright © 1996 - 2006 Arnoud Engelfriet - All rights reserved.