LAYERS

Using CSS layers you can make some interesting web pages. This is only a brief introduction to layering. For more information, see Google.com.

Suppose you see some text on a page like this:

TOP LAYER
BOTTOM LAYER

You will note that the TOP LAYER is overlaying the BOTTOM LAYER. But that can be switched around like this:

TOP LAYER
BOTTOM LAYER

With layering you can place a graphic on your page and then overlay it with text, i.e. you don't need a graphics editor to add text to the graphic!

Here are the basic of layering:

Examples:

<DIV STYLE="position:relative;top:30px;color:blue;font-size:20px;font-weight:bold;z-index:1">This is the blue layer 1</DIV>

<DIV STYLE="position:relative;top:10px;color:RED;left:20px;font-size:30px;font-weight:bold;z-index:2">This is the RED layer 2</DIV>

Which will result in this -

This is the blue layer 1
This is the RED layer 2

Now to show you how to set text on a graphic. We will use this photo of Arnold Palmer,

and add his name to the photo with white text to get this result:

Arnold Palmer

Here is the code for this effect.

<DIV STYLE="position:relative;z-index:1"><img src="slider2tn.jpg"></div>

<DIV STYLE="position:relative;top:-20px;left:5px;color:white;font-size:15px;font-weight:bold;z-index:2">Arnold Palmer</DIV>

Note that the text is moved up 20 pixels (top -20) and to the right 5 pixels (left + 5) as this is relative to the position of the 2nd <DIV> and not the first <DIV>.

Some experimentation is necessary to find the exact top, left, and font-size so the text will fit nicely on the graphic in the proper place.