A Beginner's Tutorial to HTML - Lesson 2 Adding Color shows how to add color to backgrounds and fonts
A Beginner's Tutorial to HTML - Lesson 2 Adding Color shows how to add color to backgrounds and fonts!
{short description of image}

HTML Tutorial:
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7

 
html tutorial
Garvick Com

A Beginner's Tutorial to HTML

Lesson 2
Adding Color

There are two ways to specify colors within your webpage.

1. Hexadecimal codes

Colors are defined by hexadecimal codes; the color being determined by its proportion of red, green, and blue.
Some examples of hexadecimal numbers are:

#000080
#FF0000
#00B800
#FF00FF

To choose the hexadecimal color you wish to use, check this out.

Mouse

2. Color names

There are 140 defined color names available. Be aware that they are only recognized by Netscape 3.0 and Internet Explorer 3.0 or higher.

Some examples of color names are:

Red
Green
Purple
Maroon

Mouse

Adding Colors to Your Webpage

Body Colors:

The body colors are all set within the body tag, eg:

<body bgcolor="#rrggbb" text="#rrggbb" link="#rrggbb" vlink="#rrggbb" alink="#rrggbb">

1. Background color:

<body bgcolor="#rrggbb">
This sets the background color.

2. Text color:

text="#rrggbb"
This sets the text color. If you do not specify a text color, it will automatically default to black.

3. Link color:

link="#rrggbb"
This sets the color for your links.

4. Visited link color:

vlink="#rrggbb"
This sets the color for visited links.

5. Activated link color:

alink="#rrggbb"
This sets the color for activated links.

The sample below would set the background color of the page as yellow, text as red, etc

<body bgcolor="#ffffd8" text="#ff0000" link="#0000ff" vlink="#ff0000" alink="#00a000">

Mouse

Font colors:

You can change the color of text within your page by using the <font color> tag, eg,
<font color="#rrggbb">

The code would look like this:
This text is a <font color="#ff00ff">different color</font> than the rest.

This is what it would look like in the browser:
This text is a different color than the rest.

Mouse

Table Colors

You can also vary your table background colors. To change the background for the entire table.

<table bgcolor="#00b800">

Colors Hex Number
Red #ff0000
Navy Blue #00B800

To change to background color of just one cell:
<td bgcolor="#rrggbb">.

Colors Hex Number
Red #ff0000
Navy Blue #00B800

|  Lesson 1 (Learning the Basics) | Lesson 2 (Adding Color)  | Lesson 3 (Formatting Documents) |
Lesson 4 (Graphics) |  Lesson 5 (Linking Text & Graphics) |  Lesson 6 (Lists) |
| Lesson 7 (Tables) | Back to HTML Tutorial |

 

Garvick Home | Free Recipes | Shopping Mall | Annual Events | Vancouver BC

 

Site Map | Garvick's Privacy Policy