Free Guides
Language Tutorials

HTML ( Hyper Text Markup Language )
Adding a background to your document
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:
To utilize the above image as the background, use the following syntax:
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">