Formatting

Attributes

Almost every tag has attributes (or properties or characteristics). Some examples of attributes would be color, alignment, size, etc. The beginning tag will always set the attributes. The ending tag remains unchanged; ending the tag automatically ends all attributes. No need to specify the attributes in the ending tag. Attributes can be combined in any combination.


Alignment

Note:HTML leaves a lot to be desired as far as alignment goes, but here are some of the easier methods. Everything is left-aligned by default. In the case of the <P> tag, it has an attribute of alignment (ALIGN). Notice the </P> tag. Once you set an attribute with the <P> tag, you need to end it. Remember it inserts a blank line after.

<P ALIGN="CENTER">This is centered</P>

This is centered

<P ALIGN="RIGHT">This is right-aligned</P>

This is right-aligned

<P ALIGN="LEFT">This is left-aligned</P>

This is left-aligned

<CENTER>This is centered</CENTER>

This is centered


<BODY>

<BODY> has attributes of BGCOLOR, TEXT, LINK and VLINK. BGCOLOR changes the background color of the web page. TEXT changes the color of ALL the text in the body. LINK changes the color of hyperlinks. VLINK changes the color of visited (clicked-on) hyperlinks.

Background color (BGCOLOR)
Note: You only need ONE <BODY> tag in your document.

  • This creates a solid color for the background of the web page.

Example: <BODY BGCOLOR="YELLOW">

Body text color
Note: this will change ALL text within the body

Example: <BODY BGCOLOR="black" TEXT="yellow">

Links color
Note: this will affect ALL links on the page

<BODY LINK="RED" VLINK="ORANGE">

LINK -- Unvisited link
VLINK -- Visited link


<FONT>

<FONT> has attributes of COLOR, SIZE and FACE. COLOR and SIZE are obvious, FACE changes the style or type of the font. However, that particular FACE (or font) must be installed on the user's computer or the default font will be shown instead.

<FONT COLOR="RED">color</FONT>
changes font color

Note: <FONT COLOR> will override <BODY TEXT>.

<FONT SIZE=6>size</FONT>
changes font size

<FONT FACE="COMIC SANS MS">typeface</FONT>
changes the font typeface (again, in order for this to work, the computer viewing the typeface must have that particular typeface installed or it will display only the default font, usually Times New Roman)

Note: the <FONT> characteristics can be combined.

Example: <FONT FACE="COMIC SANS MS" SIZE=5 COLOR="RED">Example:</FONT>


Lists

Three Types:

  • Ordered List: Indented list where each itme begins with a number, capital letter, a lowercase letter, an uppercase Roman numeral, or a lowercase Roman numeral.
  • Unordered List: Indented bulleted list.
  • Definition List: Indented list without numbers, letters, or bullets of any type.
<OL>...</OL> Ordered List (numbered)

<UL>...</UL> Unordered List (bulleted)

<LI> List Item. Used with <OL> and <UL>

Ordered Lists

<OL>
<LI>First Item
<LI>Second Item
<LI>Third Item
</OL>

Ordered list as it is viewed in a browser

  1. First Item
  2. Second Item
  3. Third Item

Unordered List

<UL>
<LI>An Item
<LI>Another Item
<LI>Yet Another Item
</UL>

Unordered list as it is viewed in a browser

  • An Item
  • Another Item
  • Yet Another Item

(For an example of a definition list see page 70 - section 4.12 in your text.)

Formatting Practice

! You are using a version 4 browser or older. If you are experiencing any problems with scrolling, please reload the page.