Doing It Through Layers - Page 2
August 23, 2002
Although that table example is good enough, we at Goodies Inc.,
go further and show you a couple of other methods. Here's a bit
of code that performs pretty much the exact same thing (it's done
with layers, so you have to be running Netscape 4.0 to see the
effects):
<LAYER LEFT=250 TOP=500>
<IMG SRC=newjoe02.gif>
</LAYER>
<LAYER LEFT=250 TOP=500>
<IMG SRC=overtext.gif>
</LAYER>
See the commands in action in Figure 3.2.
| |
Figure 3.2
|
Hey, he's. . . going bald.
Pretty nifty! That's my Paul McCartney, Sergeant Pepper pose-in
case you didn't know.
As you can see, the effect is the same, but the parts are a
little different. Look at the code. I set up two layers, but this
time I did it with two images. One is of the back of my head
(newjoe02.jpg), and the other is an image of the same size with
the text "That Is Not a Bald Spot" written on it. Both are set to
start 250 pixels from the left and 100 pixels from the top of the
browser's window.
Remember that layers lay one over the top of the other in the
order they are written. That's why the text image is written
second.
The trick is that I made the image with the text transparent,
except for the text itself. That way, the other image shows
through and you get the effect.
It's a bit of work. But, if you are chopping up your pages using
layers and DIV sections, this is the way to go about setting up
the effect.
Why Not Position the Text?
Positioning the text is a capital idea. We're going to use the
positioning commands available to Internet Explorer browsers to
position the text and image so that one lays over the top of the
other.
The idea is basically the same as with layers, except that you
don't have to create the text image like you did previously.
Figure 3.3 shows the effect.
 |
| Figure 3.3 |
Hey, he's ignoring me.
Here's the code:
<IMG SRC="newjoe03.jpg">
<DIV STYLE="position:absolute;
top:250px;
left:20px;
width:200px;
height:25px">
<CENTER>
<FONT SIZE="+2" COLOR="00ff00">
Looking Into The Future
</FONT>
</CENTER>
</DIV>
That DIV section should really be all on one line.
I'm looking in to my computer screen actually. It's a bad shot.
It looks like I should have a county jail number card underneath
my face.
The image is just sitting where it would normally sit. The text,
formatted to +2 font size and a green color, has been placed in a
division. Style Sheet commands then place it 250 pixels from the
top of the browser window and 20 pixels from the left side. The
height and width command set the height and width of the division
the text will sit inside. You shouldn't set that any wider than
the image. That way, you'll lessen your chance of rolling the text
over the sides.
Most of you will probably end up using the TABLE background method
up top, but maybe not. So now you can set your images with as
many words of wisdom as you can muster. I haven't any at the
moment.
Beyond HTML Goodies
Beyond HTML Goodies
RevealTrans Filter - Page 3
|