HTML Tutorials: Backgrounds
Backgrounds are a most necessary ingredient
to crafting the perfect web page. They also happen to be
drop dead easy to add. Here we go.
The most widely used backgrounds are simple colors; black
and white especially. Adding colors like these are quite
easy. In your <body> tag, type in bgcolor="white" (you
can also use hexadecimal codes like #FFFFFF). Here's and
example of what the code would look like to make a background
using the hexadecimal code #00FF00 which is normal green:
<body bgcolor="#00FF00">
Tiling an image as the background of your
page is quite easy, too. To set mybackground.gif as the background
image use this:
<body background="mybackground.gif">
Because background images tile automatically,
it is best to try to make the background image as small as
possible. For instance, if you only wanted to make a couple
of stripes appear on the left side of a background, you could
actually accomplish it by making a background image with
a height of 1 pixel.
Background colors and images function exactly
the same way in tables as they do in the full body of a web
page. To make the background of an entire table red, you
could use:
<table bgcolor="red">
To make only a certain table cell have the
image psychoback.jpg tile in the background, you could use:
<td background="psychoback.jpg">
That's all folks.
|