Kamil Kuza

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromKamil Kuza
ToMe
Subjectz-index issues in css menu tutorial
Date14 March 2006 21:11
Attachmentscreenshot of the problem
First and foremost, thanks for the great css menu
tutorial <http://www.howtocreate.co.uk/tutorials/testMenu.html>
.  I was wondering if you knew of a way to allow each <li> override any
previous <li>.  I tried assigning a higher z-index but that didn't appear to
work.  Attached is a screenshot of what I am talking about.  Any help would
be greatly appreciated.

Also, there unrelated to the above problem.  But the *left: XXpx;* css
definition under the *ul.makeMenu li > ul * section doesn't work in IE6 in
windows XP.  It works fine in Firefox though.  No matter what the number I
set, it never appears to move any.  However, I can set the width fine and it
will expand the base <ul> correctly.  I can send a screenshot w/ code
samples if you'd like.

Thanks,
Kamil Kuza
FromMe
ToKamil Kuza
SubjectRe: z-index issues in css menu tutorial
Date15 March 2006 23:22
Kamil,

> I tried assigning a higher z-index but that didn't appear to work. 

Each  LI creates a new stacking context, so its children cannot be stacked
above its following siblings unless the parent has a higher z-index.

To do that, you would need to ensure that each LI has a higher z-index is
higher than the LI that follows it. It's children will be stacked within the
stacking context of the parent, in theory making them stack above the other
LI elements. Something like this should work in Opera, Safari/Konq, Firefox,
iCab, and IE 7:

li { z-index: 100; }
li + li { z-index: 99; }
li + li + li { z-index: 98; }
li + li + li + li { z-index: 97; }
li + li + li + li + li { z-index: 96; }
li + li + li + li + li + li { z-index: 95; }

You will need to do as many as the most number of LI elements you have in a
single UL.

I have not tested this, and I am quite sure that at least one browser will
have a bug that makes it get this wrong, so try not to make the overlaps too
big, just in case.

> Also, there unrelated to the above problem.  But the /left: XXpx;/ css
> definition under the /ul.makeMenu li > ul / section doesn't work in IE6 in
> windows XP.  It works fine in Firefox though.

Works in Opera too :)
And the others.

IE 6 uses its own styles because it does not understand the selectors - see
the section in conditional comments for adjusting things in IE.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromKamil Kuza
ToMe
SubjectRe: z-index issues in css menu tutorial
Date16 March 2006 14:29
Thanks a bunch!  I was just using the Z-Index in the wrong order.  I figured
larger would mean  a higher level of rendering.  Thanks!

--Kamil
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.