A Selection of HTML Tags

The following is a selection of standard HTML 3.2 tags. It is not intended to be a complete or exhaustive listing. Neither forms tags nor browser-specific extensions are discussed. When attributes are listed for a tag, the default value (if any) is rendered in a strong style. Attributes may be upper, lower, or mixed case and their values should always be enclosed in "double quotes."

Index


!DOCTYPE

This is the first tag in an HTML document.

Attributes

None but tag will vary according to the version of HTML used.

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
Head of the document
</HEAD>
<BODY>
Body of the document
</BODY>
</HTML>

A

This tag, along with </A>, is used to enclose hypertext links in the body of an HTML document. Called an anchor tag, its behavior depends upon the parameters given. Activating

<A HREF="URL">hypertext link</A>

will send you to the page given by the URL (Uniform Resource Locator). Activating

<A HREF="#name">hypertext link</A>

will send you to the place in the document marked with the anchor tag

<A NAME="name">text</A>.

Attributes

Example

The source code for the hypertext link at the bottom of the page is <A HREF="index.html">HTML Tutorial Page</A> .

ADDRESS

This tag, along with </ADDRESS>, is used to enclose addresses in the body of an HTML document. The appearence of the text in the address is browser-dependent.

Attributes

None

Example

<ADDRESS>
Santa Claus<BR>
North Pole
</ADDRESS>

is rendered as

Santa Claus
North Pole

B

This tag, along with </B>, instructs the browser to render the the enclosed text in bold. Not all browsers interpret this tag correctly so it is better to use logical markup tags like <EM> and <STRONG>.

Attributes

None

Example

This sentence has been surrounded by <B> and </B> so that it will be rendered in a bold font.

BASE

This tag sets the base URL, indicateing where the document was originally located. Therfore, if the document is moved away from its original URL, then relative links in the document will be evaluated relative to this base URL and thus will still be correct.

Attributes

Example

Suppose a document formerly located at http://www.example.com/ is moved to a new location at http://www.anotherexample.com/. If the tag <BASE HREF="http://www.example.com/"> appears in the head of the document, then all relative links in this document will be evaluated relative to http://www.example.com/ instead of http://www.anotherexample.com/.

BIG

This tag, along with </BIG>, instructs the browser to render the the enclosed text in a bigger font.

Attributes

None

Example

This sentence has been surrounded by <BIG> and </BIG> so that it will be rendered in a bigger font.

BLOCKQUOTE

This tag, along with </BLOCKQUOTE>, encloses extended quotations.

Attributes

None

Example

To set off a paragraph as a block quote, precede the text with <BLOCKQUOTE> and end the text with </BLOCKQUOTE>.

BODY

This tag, along with </BODY>, encloses the body of an HTML document. All attributes are optional and control the colour of the background, links, and text.

Attributes

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
Head of the document
</HEAD>
<BODY>
Body of the document
</BODY>
</HTML>

BR

This tag signals a line break. The CLEAR attributes regulate where the next line should begin. CLEAR="LEFT" indicates the next line should begin flush left, even if this means skipping several lines. CLEAR="RIGHT" requires the next line to begin when the right margin is clear, and CLEAR="ALL" requires both margins to be clear for the next line.

Attributes

Example

Simply place a line break tag
<BR>
wherever you wish to force a new line to begin.

CAPTION

This tag, along with </CAPTION>, encloses the caption at the beginning of a table. The ALIGN attribute tells the browsers where to place the caption relative to the table. The default is on top.

Attributes

Example

See TABLE for examples.

CODE

This tag, along with </CODE>, encloses text that needs to represent computer printout. A fixed-width font is usually used.

Attributes

None

Example

This sentence has been surrounded by <CODE> and </CODE> so that it will resemble computer printout.

DD

This tag precedes the "definition" portion of an entry in a definition list.

Attributes

None

Example

See DL for examples.

DIV

This tag, along with </DIV>, is used to divide the structure of HTML documents.

Attributes

Example

This text is preceded by a <DIV ALIGN="CENTER"> tag and followed by a </DIV> tag. The alignment of the division contents is centered by the ALIGN attribute.

DL

This tag, along with </DL>, encloses a definition list. Each item in the list is split into two parts, the term (which is preceded by DT) and the definition (which is preceded by DD).

Attributes

None

Example

<DL>
<DT>Here is the first term in the definition list.
<DD>Here is the first definition in the definition list.
<DT>Here is the second term in the definition list.
<DD>Here is the second definition in the definition list.
</DL>

is rendered as

Here is the first term in the definition list.
Here is the first definition in the definition list.
Here is the second term in the definition list.
Here is the second definition in the definition list.

DT

This tag precedes the "term" portion of an entry in a definition list.

Attributes

None

Example

See DL for examples.

EM

This tag, along with </EM>, instructs the browser to emphasise the enclosed text. The form of this emphasis, be it bold, italic, or underline, is browser-dependent.

Attributes

None

Example

This sentence has been surrounded by <EM> and </EM> so that it will be emphasised in some manner.

FONT

This tag, along with </FONT>, instructs the browser to alter the text colour or size. Absolute sizes are integers ranging from 1 to 7 whilst relative sizes are signed integers such as +1 (larger font) or -2 (smaller font). This attribute may be phased out of future versions of HTML.

Attributes

Example

The word RED should appear larger than the other text and in the colour red. The <FONT> tag source code is <FONT SIZE="+2" COLOR="#FF0000">.

Hn

This tag, along with </H n>, encloses a header in the body of an HTML document. The variable n takes the value 1, 2, 3, 4, 5, or 6. An n-value of 1 gives the largest header whilst an n-value of 6 gives the smallest. The alignment of headers can be altered with the ALIGN parameter. The default alignment is LEFT (left-justification). There is an automatic line break at the end of each header so you do not need to include it.

Attributes

Example

This is an H1 header

This is an H2 header

This is an H3 header

This is an H4 header

This is an H5 header
This is an H6 header

HEAD

This tag, along with </HEAD>, encloses the head of an HTML document.

Attributes

None

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
Head of the document
</HEAD>
<BODY>
Body of the document
</BODY>
</HTML>

HR

This tag creates a horizontal rule or line in the document. Optional attributes control the alignment and appearance of the rule.

Attributes

Example

The <HR> tag is used at the bottom of this document.

HTML

This tag, along with </HTML>, encloses an HTML document.

Attributes

None

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
Head of the document
</HEAD>
<BODY>
Body of the document
</BODY>
</HTML>

I

This tag, along with </I>, instructs the browser to render the the enclosed text in italic. Not all browsers interpret this tag correctly so it is better to use logical markup tags like <EM> and <STRONG>.

Attributes

None

Example

This sentence has been surrounded by <I> and </I> so that it will be rendered in an italic font.

IMG

This tag places an image in the document. If the image is embedded in text, then the ALIGN attribute positions the text along the bottom, the middle, or the top of the image, or lets it flow around the left or right side of the image. The text following the ALT attribute is displayed if the image cannot be loaded for some reason. If the image is used as a hyperlink, then the BORDER attribute controls the width of the border around the image. The ISMAP attribute indicates that the image is an imagemap. The only necessary attribute is SRC which gives the name of the image file.

Attributes

Example

 The source code for this image is <IMG SRC="tinyball.gif" ALIGN="BOTTOM" ALT=" " WIDTH="100" HEIGHT="100">.

LI

This tag precedes each item in either an ordered or unordered list.

Attributes

Example

See OL or UL for examples.

META

This tag appears in the head of the document and provides additional information to the browser or search engine. The attributes always occur in pairs: NAME and CONTENT or HTTP-EQUIV and CONTENT.

Attributes

Example

To prevent robots from indexing or following the links on a page, use the tag

<META NAME="robots" CONTENT="noindex, nofollow">

in the head of the document.


OL

This tag, along with </OL>, encloses an ordered list. Each item of an ordered list is preceded by a number or letter, depending upon the browser or optional attribute setting.

Attributes

Example

<OL>
<LI>Here is the first item in the ordered list.
<LI>Here is the second item in the ordered list.
</OL>

is rendered as

  1. Here is the first item in the ordered list.
  2. Here is the second item in the ordered list.

P

This tag separates paragraphs. It is optional to precede a paragraph with <P> and end it with </P> although most omit the closing tag.

Attributes

Example

Here is the first sentence. At the end of this second sentence, there is a <P> tag.

This is the third sentence and the start of a new paragraph.


PRE

This tag, along with </PRE>, encloses material that is preformatted; that is, appearing with spacing and line breaks as typed. The only other HTML tags that may be used within these tags are anchor tags and character highlighting tags like <EM> and <STRONG>, as well as images.

Attributes

None

Example

<PRE>
The beginning of this sentence          is   w i d e l y


separated from the end of the sentence.
Line breaks occur after the word widely and sentence.
</PRE>

is rendered as

The beginning of this sentence          is   w i d e l y


separated from the end of the sentence.
Line breaks occur after the word widely and sentence.

SMALL

This tag, along with </SMALL>, instructs the browser to render the the enclosed text in a smaller font.

Attributes

None

Example

This sentence has been surrounded by <SMALL> and </SMALL> so that it will be rendered in a smaller font.

STRONG

This tag, along with </STRONG>, instructs the browser to render the the enclosed text in a strong manner.

Attributes

None

Example

This sentence has been surrounded by <STRONG> and </STRONG> so that it will be rendered in a strong manner.

SUB

This tag, along with </SUB>, instructs the browser to render the the enclosed text as a subscript.

Attributes

None

Example

The source code for the symbol for water H2O is H<SUB>2</SUB>O.

SUP

This tag, along with </SUP>, instructs the browser to render the the enclosed text as a superscript.

Attributes

None

Example

The source code for the speed of light 2.998 x 108 m/sec is 2.998 x 10<SUP>8</SUP> m/sec.

TABLE

This tag, along with </TABLE>, encloses a table. All of the attributes are optional.

Attributes

Example

<TABLE ALIGN="CENTER" BORDER="1" WIDTH="100%">
<CAPTION><EM>My Cats</EM></CAPTION>
<TR><TH>Name</TH> <TH>Colour</TH></TR>
<TR><TD>Ralph</TD> <TD>black and white bicolour</TD></TR>
<TR><TD>Shadow</TD> <TD>sealpoint with white paws and chest</TD></TR>
<TR><TD>Turkey Grunt</TD> <TD>sealpoint</TD></TR>
</TABLE>

is rendered as

My Cats
NameColour
Ralphblack and white bicolour
Shadowsealpoint with white paws and chest
Turkey Gruntsealpoint


TD

This tag, along with </TD>, encloses a table data item. The optional attributes control the size and appearance of the cells. If the NOWRAP attribute is included, then automatic word-wrapping is disabled within the cell.

Attributes

Example

See TABLE for examples.

TH

This tag, along with </TH>, encloses a table heading item. The optional attributes control the size and appearance of the cells. If the NOWRAP attribute is included, then automatic word-wrapping is disabled within the cell.

Attributes

Example

See TABLE for examples.

TITLE

This tag, along with </TITLE>, encloses the title in the head of the document. Ideally, the title should be short and descriptive of the contents of the document. No other HTML tags may be used in the title.

Attributes

None

Example

The source code for the title of this page is <TITLE>HTML Tags</TITLE>.

TR

This tag, along with </TR>, encloses a table row. The ALIGN and VALIGN attributes may be overridden by the attributes in the <TD> and <TH> tags.

Attributes

Example

See TABLE for examples.

TT

This tag, along with </TT>, instructs the browser to render the the enclosed text in a fixed-width or teletype font.

Attributes

None

Example

This sentence has been surrounded by <TT> and </TT> so that it will be rendered in a fixed-width font.

U

This tag, along with </U>, encloses text which is to be underlined.

Attributes

None

Example

This sentence has been surrounded by <U> and </U> so that it will be underlined.

UL

This tag, along with </UL>, encloses an unordered list. Each item of an unordered list is preceded by some kind of symbol called a bullet, the exact symbol depending upon the browser or optional attribute setting.

Attributes

Example

<UL>
<LI>Here is the first item in the unordered list.
<LI>Here is the second item in the unordered list.
</UL>

is rendered as


[HTML Tutorial Home Page] [Previous Page]
Obliquity Valid HTML 3.2! Copyright © 1995-2007 by David Harper and L.M. Stockman
All Rights Reserved
Designed and maintained by Obliquity
Last modified on 1 January 2007
https://www.obliquity.com/computer/html/tags.html