[Contents] [Previous] [Next] [Alphabetical Tag List] [Index]

HTML Tag Reference

Text Characteristics

This section discusses the tags that set text characteristics. With the exception of the BASEFONT tag, the tags discussed in this section are inline tags that have an opening and closing tag. They do not cause a line break, and they can be used to enclose arbitrary pieces of a document.

All these tags can use the attributes ID, CLASS, LANGUAGE, and STYLE as described in Universal Attributes. To simplify the tag explanations, the universal attributes are not included in the syntax for each of the inline tags discussed in this section.


B

(boldface)

The B tag displays text in boldface type.

Syntax

<B>...</B>

Example

My preferred browser is <B>Netscape Navigator</B>. 
The file text.htm shows this example in action in a separate window.


BASEFONT

(default font size)

The BASEFONT tag sets the default font size for text in the document. If the user has set a default font size in Navigator, this tag overrides it. If the base font size is not defined, the default is 3. You can use the BASEFONT tag anywhere in the header or body of a document to change the base font, and you can use it multiple times to change the base font in different parts of the document.

Syntax

<BASEFONT 
  SIZE="number">
...
</BASEFONT>

SIZE="number"

specifies the font size from 1 (smallest) to 7 (largest). The default is 3. Navigator 1.1

Example

The following example uses the BASEFONT tag to set the default font size to 4, then enlarges and decreases the font size using the FONT tag. All changes made to the font size are relative to the base font size, which is 4. Finally the example sets the basefont to size 3.

<BASEFONT SIZE="4">
<I>Netscape Navigator</I> lets the user select a comfortable base font
size, but this can be reset for all or part of a page.
<FONT SIZE="+3">Doing so causes subsequent font size changes </FONT>
<FONT SIZE="-1"> toexecute relative to the new base font size.</FONT>
<BASEFONT SIZE="3">
The file text.htm shows this example in action in a separate window.


BIG

(bigger font size)

The BIG tag increases the font size from its current value by 1. It has the same effect as using the FONT tag with a SIZE value of +1. Navigator 2.0

Syntax

<BIG>...</BIG>

Example

The following example increases the font size in three steps for "bigger, and bigger, and bigger."

<P>As Alice ate the cookies, she felt herself grow <BIG> bigger, and
<BIG>bigger, and <BIG> bigger.</BIG></BIG></BIG>
The file text.htm shows this example in action in a separate window.


BLINK

(blinking text)

The BLINK tag makes text blink on and off in Netscape Navigator.

Syntax

<BLINK>...</BLINK>

Example

<P><BLINK> Blinking text </BLINK> can be annoying, so use it sparingly.
The file text.htm shows this example in action in a separate window.


CITE

(inline citation)

The CITE tag displays text in a different style to indicate that it is a citation. Netscape Navigator displays citations in italics.

Use the CITE tag to display inline citations, and use the BLOCKQUOTE tag to display block-level quotes that start on a new line.

Syntax

<CITE>...</CITE>

Example

<P>Mozilla said to the crowd, <CITE>"Visit Netscape's web site."
</CITE></P>
The file text.htm shows this example in action in a separate window.


CODE

(inline code)

The CODE tag displays text in the browser's default fixed-width font.

For large sections of code where formatting is important, use the PRE or XMP tags to preserve the space characters and line breaks used in a program listing.

Syntax

<CODE>...</CODE>

Example

<P>The <CODE>onLoad</CODE> attribute for the BODY tag lets you
define an action that occurs when the document has finished
loading. For example, <CODE>onLoad="function1(); function2();
return false;"</CODE>. Notice that the <CODE>onLoad</CODE> code
should always return <CODE>false</CODE>.
</P>
The file text.htm shows this example in action in a separate window.


EM

(emphasized text)

The EM tag displays text in an emphasized style.

Netscape Navigator displays emphasized text in italics.

Syntax

<EM>...</EM>

Example

<P>We ship your products overnight <EM>for free</EM>!</P> 
The file text.htm shows this example in action in a separate window.


FONT

(font color, face, and size)

The FONT tag lets you change the color, size, and typeface (font family) of the font. All text between the <FONT> and </FONT> tags is displayed with the specified font characteristics. Navigator 1.1.

If the BASEFONT tag has previously been used to set the base font, font size changes specified with the SIZE attribute in the FONT tag are relative to the base font. Otherwise they are relative to the default font for the browser.

Syntax

<FONT 
  COLOR="
color"
  FACE="
fontlist"
  POINT-SIZE="
pointSize"
  SIZE="
number"
  WEIGHT="
boldness"
>
...
</FONT>

COLOR="color" defines the desired text color. Navigator 2.0

See Color Units for information about color values.

FACE="fontlist"

specifies a comma-separated list of font faces. Navigator 3.0

Navigator uses the first font in the list if it is available, otherwise it uses the second font in the list if it is available, and so on. If none of the specified fonts are available, no font face change occurs. Each entry in the font list can be a specific font name, for example "helvetica", or it can be a generic font name. The generic font names are serif, sans-serif, cursive, monospace, and fantasy.

If you want to guarantee that a specific font is available to everybody who views your document, you can attach a downloadable font to your document, as discussed in Part 3. Downloadable Fonts in Dynamic HTML in Netscape Communicator.

POINT-SIZE="pointSize"

indicates the point size of the font. The size should be specified as a positive integer. This attribute lets you set exact point sizes, whereas the SIZE attribute lets you set the font size relative to the default size. Navigator 4.0

SIZE="number"

defines the relative size of the font, in a range from 1 to 7, with a default size of 3. A value of 1 results in the smallest font, and a value of 7 results in the largest font. You can also specify the size using a plus or minus sign in front of the number to change the size with respect to the base font size.

WEIGHT="boldness"

indicates the weight, or "boldness" of the font. This attribute allows you to specify degrees of boldness. The value is from 100 to 900 inclusive (in steps of 100), where 100 indicates the least bold value, and 900 indicates the boldest value. Navigator 4.0.

Example

<P>Here you see the effect of
<FONT face="helvetica,arial,sans-serif" color=green size=+2>
using the FONT tag to change the font to a green sans-serif font.
</FONT>
Now the font will change to a
<FONT face="timesroman,serif" size=18 color=red>
red font that has a size of 18 points.</font>
The file text.htm shows this example in action in a separate window.


I

(italic)

The I tag displays text in italic.

Syntax

<I>...</I>

Example

<P>Putting text in <I> italic </I> can slant its meaning.</P>
The file text.htm shows this example in action in a separate window.


KBD

(keyboard text)

The KBD tag displays text in a special font that is meant to indicate that the user should type the text on the keyboard.

Netscape Navigator displays the specified text in the current fixed-width font.

Syntax

<KBD>...</KBD>

Example

<P>At the first prompt, enter the user name <KBD>trainee</KBD>
and at the next prompt enter the password
<KBD>goodlearner</KBD>.
The file text.htm shows this example in action in a separate window.


PLAINTEXT

(display rest of document as-is)

The PLAINTEXT tag displays text in a plain text style, with no additional styles (such as bold, italics, underlined). The PLAINTEXT tag suppresses interpretation of all HTML tags in the remainder of the document.

This tag has been deprecated in favor of PRE.

Syntax

<PLAINTEXT>

Example

The following example uses the PLAINTEXT tag.

<PLAINTEXT>
The <B>PLAINTEXT</B> tag suppresses interpretation of HTML tags that
<I>follow</I> it to the end of the document.

S

(strikeout type)

See STRIKE. The S tag is exactly equivalent to the STRIKE tag. Navigator 3.0


SMALL

(smaller font size)

The SMALL tag reduces the font size from its current value by 1. It has the same effect as using the FONT tag with a SIZE value of -1. Navigator 2.0

Syntax

<SMALL>...</SMALL>

Example

The following example decreases the font size "smaller" and again for ,"and smaller."

<FONT SIZE="+1">
When Alice ate from the Caterpillar's mushroom, she grew
<SMALL>smaller and <SMALL>smaller.</SMALL></SMALL></SMALL>
</FONT>
The file text.htm shows this example in action in a separate window.


STRIKE

(strikeout type)

The STRIKE tag displays text with a line (strike) through it. The STRIKE tag has the same effect as the S tag. Navigator 3.0

Syntax

<STRIKE>...</STRIKE>

Example

<P><STRIKE>The judge ordered that the witness's testimony be struck 
from the record.</STRIKE>
<P><S>Strike-through text often means text has been changed.</S>
The file text.htm shows this example in action in a separate window.


STRONG

(strong emphasis)

The STRONG tag displays text with a strong emphasis. Netscape Navigator uses boldface to indicate strong emphasis.

Syntax

<STRONG>...</STRONG>

Example

<P><STRONG>CAUTION!</STRONG>Do not press the reset key unless you have
tried every other way to reboot the computer.</P>
The file text.htm shows this example in action in a separate window.


SUB

(subscript)

The SUB tag displays text as a subscript. A subscript appears slightly below the baseline (bottom edge) and in a smaller font. Navigator 2.0

Syntax

<SUB>...</SUB>

Example

<P>The chemical notation for water is <CODE>H<SUB>2</SUB>0</CODE>.
The file text.htm shows this example in action in a separate window.


SUP

(superscript)

The SUP tag displays text as a superscript. A superscript appears slightly above the top of the preceding text and in a smaller font. Navigator 2.0

Syntax

<SUP>...</SUP>

Example

The following example displays the 2 in e=mc2 as a superscript.

<P>If Einstein was right, then <CODE>e=mc<SUP>2</SUP></CODE>.
The file text.htm shows this example in action in a separate window.


TT

(typewriter font)

The TT tag displays text in the fixed-width font. It usually has the same result as the KBD and CODE tags.

Syntax

<TT>...</TT>

Example

<P>To run the program, type <TT>xyz</TT> at the command prompt.
The file text.htm shows this example in action in a separate window.


U

(underline)

The U tag underlines the text it encloses. Gaps between words in the enclosed text are also underlined. Navigator 3.0

Syntax

<U>...</U>

Example

<P><U>All the text in this paragraph is underlined.</U></P>
The file text.htm shows this example in action in a separate window.


VAR

(variable)

The VAR tag displays text in a special font to show that it is a variable. Netscape Navigator displays VAR elements in italic.

Syntax

<VAR>...</VAR>

Example

<P>In this example, the global variable <VAR>doc1</VAR> is bound 
to the current document.</P>
The file text.htm shows this example in action in a separate window.


[Contents] [Previous] [Next] [Alphabetical Tag List] [Index]

Last Updated: 01/26/98 21:33:44


Copyright 1998 Netscape Communications Corporation