DEMO
Overview
Page 3
Chapter 3: Designing a Web Page

At A Glance:

-Intro to the Internet

-The Hypertext Markup Language

-Designing a Web Page

-Lists and Links

-Adding Graphics

-Multimedia on the Web

-Tables for Data and Design

-Frames

-Forms and Scripting

-Creating Good HTML

 

Customizing Text

As you have surfed the Web, you have undoubtedly seen Web pages with text of different sizes. You may have even come across text in which the font and color have been altered from what is usually displayed by your browser. These pages make use of the <FONT> tag.

By enclosing text within a <FONT> block, you can change the size, color, and face (or type) of the font. Since there are three different things that you can change, there are three different attributes:

  • SIZE: used to change the size of the font
  • COLOR: used to change the color of the font.
  • FACE: used to change the type of font used to display the text.

We will first go through each attribute individually, but you can use all three attributes within one <FONT> tag to produce combinations of effects.

SIZE

Using the SIZE attribute of the <FONT> tag, you can change the relative size of the text. The format for specifying the new size of the text is

<FONT SIZE=+1>Text Here</FONT>

Be sure to include the closing tag or else the entire document will change to that size. In the example, I used +1 as the relative size of the font. Acceptable values for the SIZE attribute are 1, 2, 3, 4, 5, 6, and 7. The number can be either positive or negative. This means that you can make the font smaller than usual by specifying a negative number.

I have said that the SIZE attribute changes the relative size of the font. The default size of a font in a browser is 3. This number can be changed with the <BASEFONT> tag. Somewhere in your document, often after the <BODY> tag, place a tag similar to <BASEFONT SIZE=#> where # is any of the valid numbers mentioned before. For example, to set the base font size to 2, then you would use

<BASEFONT SIZE=2>

at the beginning of your document. From then on, whenever you use the SIZE attribute in the <FONT> tag, the size of the font will be incremented relative to your specified value of the base font size.

COLOR

Besides changing the size of the font, you can also change the color using the COLOR attribute. The color can be specified using two different methods. One method is to specify the color by name. Commonly used names are RED, BLUE, GREEN, and YELLOW. For example,

<FONT COLOR="red">Sample Text</FONT>

would display the words "Sample Text" in red as seen here.

The other method is to specify the color in terms of its hexadecimal equivalent. Hexadecimal works by indicating the percentages of red, green, and blue in the color. Hexadecimal will be discussed in more detail in chapter 5.

FACE

The third way to customize the look of the font on your Web page is to change the type of font. The font of text is often referred to as the face of the font. To specify the face you will use the FACE attribute.

<FONT FACE="Arial,Lucida Sans,Times Roman">Sample Text</FONT>

Notice in the previous tag that I specified three different font types. The reason for this is also a reason for being careful when using the FACE attribute and choosing which fonts to use. Not all computer systems have the same fonts. There are literally thousands of fonts and only a handful of fonts are standard on all computers. Since the FACE attribute allows for multiple fonts, then the browser will start with the first font in the list and if that one is not available, then it will try the second and then the third. If none of the fonts is present on the system or the attribute is not supported, then the browser will use its default font. The FACE attribute is only supported on the newer browsers by Microsoft and Netscape.
Now, I can also combine all three atributes to generate the effect below.

<font size=+1 color="blue" face="Arial,Lucida Sans,Times Roman">HTML is FUN!!!</font>

HTML is FUN!!!

Previous Next


Copyright © 1998 Global Internet & Network Services