You can use a variety of elements to set the size and style of the text
characters. For example, you can use the B or STRONG element to make text
bold, and the I or EM element to make text italic. Similarly, you can use
the S or STRIKE element to strike out text, and the U element to underline
text. The following examples set words and phrases within the paragraphs
to bold and italic:
<P>This
<B>word</B> is formatted as bold. This <I>word</I> is formatted
as italic.
This displays
as:
This word
is formatted as bold. This word is formatted as italic.
<P><STRONG>Text
formatted as strong.</STRONG> <EM>Emphasized text.</EM>.
This displays
as:
Text formatted
as strong. Emphasized text.
You can apply
character formatting to a sequence of paragraphs (for example, those tagged
with P) by enclosing the paragraphs with a character formatting element.
For example, to make all the text in a sequence of paragraphs bold, do
the following:
<B>
<P>This
text is bold.
<P>And this
text is bold too.
</B>
Although you
can use this technique with simple paragraphs, some elements "block" the
effect of the character formatting elements. For example, you cannot make
all the text in a table bold by enclosing it in a B element.
You can create
superscripts and subscripts by using the SUP and SUB elements. These elements
reduce the size of the text and align it at the top or bottom of the current
line of text.
You can change
the size of the text by using elements such as BIG and SMALL, or by using
the SIZE= attribute with the FONT element. The following example increases
the size of the word "LARGE" and reduces the word "TINY":
<P>Use the
<BIG>LARGE</BIG> machine for business,
the <SMALL>TINY</SMALL>
machine for personal items.
If you use
the FONT element to change text size, you can specify either a fixed or
relative size. A fixed size is a number in the range 1 through 7. A relative
size is a positive or negative number, preceded by the plus (+) or minus
(-) sign, that indicates a size that is relative to the base font size,
as set using the BASEFONT element. The following example shows the effect
of using relative sizes:
<BASEFONT
SIZE=3> This sets the base font size to 3.
<FONT SIZE="+4">
Now the font size is 7.
<FONT SIZE="-1">
Now the font size is 2.
You can also
use the FACE= attribute with the FONT element to set the name of the font
used for text. Some of the most-used fonts are "Arial," "Times New Roman,"
and "Courier New," but you can use the name of any font installed on the
computer on which your HTML document is being viewed. The following example
sets the Arial font for the text in the section heading:
<H1><FONT
FACE="ARIAL">Welcome to Internet Explorer!</FONT></H1>
If the given
font is not available, Internet Explorer uses a default font. To increase
the chances that a font of your choice is applied to the text, you can
specify more than one font in a FONT element. In this case, Internet Explorer
checks for each font (in the order given) before using the default font.
In the following example, Internet Explorer checks for "Arial", "Lucida
Sans", and "Times Roman" before resorting to the default font:
<FONT FACE="Arial,Lucida
Sans,Times Roman">
This text
will be in either Arial, Lucida Sans, or Times Roman,
depending
on which fonts you have installed on your system.
</FONT>
You can apply
size and font changes to a sequence of paragraphs by enclosing the paragraphs
with the FONT element. As with other character formatting elements, some
elements do not accept the effect of FONT, so this technique does not work
for all paragraphs. For example, table elements accept changes to the font's
name but size changes are not accepted. |