LESSON 3: Fonts. Rule

  1. Fonts and browsers.
  2. Element BASEFONT.
  3. Element FONT.
  4. Element HR (Horizontal Rule).
  5. Examples.

1. Fonts and browsers.

Authors of web pages can suggest rudimentary font changes. If they don't, the text appears in size, color and face as defined by user's browser.
Go to Top


2. Element BASEFONT

\..........Description

The BASEFONT element allows authors to suggest the size of base font used for calculating of relative font size values (specified by SIZE attribute of FONT element).

\..........Syntax

<BASEFONT SIZE="pixels">

BASEFONT has no end tag.

\..........Attributes

Attribute Description
SIZE="pixels" Specifies the base font size on a browser-dependent scale of 1 to 7, with the default being 3.

\..........Examples to see

Example 1 demonstrates use of the BASEFONT element. Go to Top


3. Element FONT

\..........Description

FONT element changes face, color and size of the font.

\..........Syntax

<FONT
     COLOR="color"
     FACE="font_name"
     SIZE="size">
.....
</FONT>

\..........Attributes

Attribute Description
COLOR="color" Specifies the color of the font.
FACE="font_name" Specifies the font name or list of font names.
SIZE="size" Specifies the size of the font. The size is:

number from 1 to 7 (absolute size, e.g. SIZE=6)
-OR-
+ or - followed by number (relative size, e.g. SIZE="+3" or SIZE="-2").

Note: To specify list of font names use comma as separator. For example:

FACE="Verdana,Impact,Arial".

The browser checks to see if the first specified font is installed, and if not, it checks for the second and so on. The text is displayed with the first installed font specified in the list. If all listed fonts are not installed on the viewer's computer, the browser uses the default font.

\..........Examples to see

Example 2 demonstrates FONT attributes. Go to Top


4. Element HR (Horizontal Rule).

\..........Description

The HR element defines a horizontal rule for visual browsers.

\..........Syntax

<HR
     ALIGN="left"|"center|"right"
     SIZE="pixels"
     WIDTH="percentage"
     NOSHADE>


HR has no end tag.

\..........Attributes

Attribute Description
ALIGN= "left"
"center"
"right"
Specifies the horizontal alignment of the rule. The default is center.
SIZE="pixels" Specifies the line height.
WIDTH="percentage" Specifies the line width as percentage of window width.
NOSHADE Specifies the solid line.

\..........Examples to see

Example 3 demonstrates use of the HR element. Go to Top


5. Examples

Choose an example and move below the text box to see the HTML code.

Example 1: Using BASEFONT.
Example 2: Changing face, color and size of font.
Example 3: Drawing a horizontal rule.
Preview
Go to Top