Cafe LaTe Home
Contents
Background
Getting Started
Images
Links
Tables
Lists
Resources
Tag Index
Background Color

Section Two - Getting Started:
   Lesson 2-2: Background Color



   White is a good, basic background color for any web page. After all, most printed pages use black text on white paper. However, you don't have to use a white background if you don't want to. This page, for example, uses a light pink. Try selecting colors from the list box below and see how this page looks with different background colors.

Just open the list and click a background color:

   It is easy to change the background color of your web page, but don't get carried away. Just because you can use bright colorful backgrounds, that doesn't mean you should. If you just used the color selector above, you probably noticed that this page does not look good with many of the colors. The background color should match the other elements on your page. Readability is another important consideration. Text becomes difficult to read if you use a dark background. If there is a lot of text on your pages, you will probably want to use a light background color.

   Background color is applied to the whole body of the page, not just a part of it. Therefore, background color is set as an attribute of the body tag, with the value being the color code. The background color attribute bgcolor is put inside the opening body tag.
It looks like this:

body bgcolor="#nnnnnn"


...where nnnnnn is the hexadecimal value of the color. Every color has a hexadecimal code number. For example, "#FFFFFF" is the hex code for white, and "#FFB6C1" is the hex code for pink. Color codes are always preceded by a pound sign (#).

Since you are a beginner at web page building, we won't go into all the details of how to calculate hexadecimal color codes. Let's do it the easy way. Take a look at this Color Code Chart. When looking at the color chart, choose a few colors you would like to test on your own page, then write down the hex codes for those colors.

ps. There is also a link to this chart in the Resources section, so you can refer to it at any time.




Practice:

Having trouble?    Open your practice file (the one you created in the previous lesson). Add a background color to your page using one of the color codes you chose from the color chart. (ps. Don't forget the space between the tag and the attribute. And don't forget the # before the color code.)

body bgcolor="#nnnnnn"

   After setting the color, save your file and check it in your browser.



Review:
  • The bgcolor attribute is used to designate a background color for a page, and it is placed inside the opening body tag.
  • Colors are designated with hexadecimal color codes.
  • Choose a color that matches the other elements on your page.





 
Previous Lesson Next Lesson
 

[Cafe LaTe Home] [Chat Lounge] [Community Center] [Newspaper] [HTML Tutor]



Last revision: 2002/03/04, Copyright © The Three Cities Workshop