[an error occurred while processing this directive]

Site Menu

HTML
Learn all about HTML, how to format text, add images, create tables, meta taga, and more!
.
JavaScript
Get the low down on JavaScript. See how to create popular JavaScript applications like drop down menus, clocks, dynamic messages, popup boxes, and more.
.
CGI
Concise, easy to follow introdction to CGI and how to install CGI scripts.
.
Web Design
A miscellanous section that includes various web design tutorials

 

123 Web Design!

Adding a background

The first thing most beginner webmasters want to do with their web page is to add a background to it, whether it be a background color or image. By default, a document with no background appears gray (or white in newer browsers) in the background. That's easy to fix. Lets begin by adding a background color. To add a splash of color to your document, add the following code inside the <body> tag itself:

<body bgcolor="#XXXXXX">

where xxxxxx is the hex code for the color you want. "Why can't I just use the name of the color", you ask. Well, ask the creators of HTML that question! Anyhow, here's a small chart of the hex code for some common colors:

black #000000
white #FFFFFF
blue #0000FF
yellow #FFFF00
red #FF0000
green #008000
lime #00FF00
silver #C0C0C0

For example, the below gives our document a background of black:

<body bgcolor="#000000">

Now that you know how to give your doc a background color, lets move on to learn how to give it an image as well. For illustration, lets first bring in a nice image we'll be using:

backgr15.jpg (2119 bytes)
backgr15.jpg

To utilize the above image as the background, use the following syntax:

<body background="backgr15.jpg">

Many authors like to give their document BOTH a background color, and an image as well. This way, while the image has yet to come through from the server, surfers will see a background color in the meantime:

<body bgcolor="#000000" background="backgr15.jpg">