Connecting Tech Pros Worldwide Forums | Help | Site Map

Positioning Text Over an Image

DB McGee
Guest
 
Posts: n/a
#1: Jul 20 '05
I'm having difficulities positioning text over an image. Specifically, I am
trying to position the text within each <div> to the topleft of each image
within that <div>.

The following works as I want it to in IE6, but the text is not properly
positioned in Mozilla 1.4.

A test page can be found here:

http://members.rogers.com/db-ls/test/textoverimage.html


CSS:

#navtabs { width: 190px; }
..navtab { position: relative; height: 19px; width: 190px; margin-bottom:
1px; }
..navtab img { cursor: pointer; }
..navtab p { position: absolute; float: left; left: 0px; top: 0px; z-index:
10; cursor: pointer; }

HTML:

<div id="navtabs">
<div class="navtab"><img src="/images/navtab_1.gif" id="navtab_1"
isrollover="yes" alt="" width="190" height="19"><p>link 1</p></div>
<div class="navtab"><img src="../images/navtab_2.gif" id="navtab_2"
isrollover="yes" alt="" width="190" height="19"><p>link 2</p></div>
<div class="navtab"><img src="../images/navtab_3.gif" id="navtab_3"
isrollover="yes" alt="" width="190" height="19"><p>link 3</p></div>
</div>




Eric Bohlman
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Positioning Text Over an Image


"DB McGee" <noreply@noreply.com> wrote in
news:23avb.3423$H8X1.2661@twister01.bloor.is.net.c able.rogers.com:
[color=blue]
> I'm having difficulities positioning text over an image. Specifically,
> I am trying to position the text within each <div> to the topleft of
> each image within that <div>.
>
> The following works as I want it to in IE6, but the text is not
> properly positioned in Mozilla 1.4.[/color]

Because it has a default top margin for paragraphs.
[color=blue]
> .navtab p { position: absolute; float: left; left: 0px; top: 0px;
> z-index: 10; cursor: pointer; }[/color]

Add "margin: 0" (I see you've already taken out the "float: left").
Closed Thread