PDA

View Full Version : Z-index not working in FF



kdd
May 31st, 2007, 08:48 PM
I have an element of position: fixed. Another element of regular static position. I want to display this static element on top of the fixed element. I tried to increase the z-index of the static element. The element is the top element in IE, but in FF, z-index doesn't do anything. Some help here would be great! Thanks. :)

simplistik
May 31st, 2007, 09:05 PM
z-index only works w/ absolute positioning

ditt0
May 31st, 2007, 09:07 PM
yes, what simp said :) (and relative)

crap, I'm getting slow at it :lol:

kdd
May 31st, 2007, 09:30 PM
I should've posted this before: I saw your reply saying that somewhere, so, there's no way? (I have to use fixed).

ditt0
June 1st, 2007, 12:17 AM
Could you post your code?

kdd
June 1st, 2007, 01:24 AM
Well, there isn't anything to post really... The thing is it works in IE, but it doesn't work in FF...
But it's like:

#itemOne { position:fixed; }
#itemTwo { position:absolute; z-index: 99999; }

But even this high z-index doesn't work...

Edit: Ok. This is just weird. I, dynamically, changed #itemOne to be position:absolute; and it still doesn't work... I also assigned z-index to be 0...

ditt0
June 1st, 2007, 08:05 AM
It should work, that's why I wanted to see the whole code. Here's an example:
http://thinkpinkstudio.com/test/zindex.html

Esherido
June 1st, 2007, 08:23 AM
z-index only works w/ absolute positioning
I've gotten z-index to work with relative and fixed positioning in both Firefox and IE 7.

simplistik
June 1st, 2007, 08:37 AM
yes, what simp said :) (and relative)



I've gotten z-index to work with relative and fixed positioning in both Firefox and IE 7.
yea mah bad u guys are right, i don't do much layering ;) though that's no excuse

DDD
June 1st, 2007, 10:28 AM
dammit I missed a chance to do one better than Simp.

kdd
June 1st, 2007, 02:28 PM
Thanks you very much guys and girl. :P I'm doing something very similar to what you did, ditt0. I must be making some tiny mistake that I can't pinpoint right now...

Edit: By the way, the element with absolute position will be dragged by mouse... I don't know if that'll change some answers...

kdd
June 1st, 2007, 03:40 PM
I tried too much, and I'm still not sure what is wrong... :(

Some say zIndex only works with abs and rel. position, others say it also works with fixed...

kdd
June 1st, 2007, 05:11 PM
WOW!!! I figured it out! I knew Firefox wasn't wrong, it's never wrong! IE just assumes too much, so it was working in IE, when it shouldn't...

The problem was that this <div><img></div> was embedded into other divs preventing that from properly inherting z-index... It's like a child having higher age than parent. It just isn't possible... The solution was that I moved that div to be totally outside, and now it works in both IE and FF. :pleased:

Edit: sorry for multi-posting...

Esherido
June 2nd, 2007, 08:38 AM
Glad you figured it out, I've learned that most CSS problems or mistakes come from simple oversight or stupidity.

biznuge
June 2nd, 2007, 09:59 AM
yeah, but that doesn't stop you swearing at your browser for half an hour first though...=)

Esherido
June 2nd, 2007, 10:05 AM
^ That's the real skill behind web design. :P

kdd
June 2nd, 2007, 02:43 PM
^ :lol: I guess, yeah...