473,413 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

z-index problem for css dropdown menu

Hi.

I have created a css dropdown menu (based on an article in www.alistapart.com). It is working just fine except for one annoying issue: the popup menu (<ul> nested within a <li>) now shows behind the other top-level <li> elements.

The most annoying thing is that it didn't do this before...! I made some changes to make it standards compliant, and some general tidying up, but I cannot remember exactly what I did that caused this to break.

I have tried z-index in all manner of ways and nothing changes. This is not browser-specific... (It worked without z-index before..???)

URL:http://dev4.carib-sys.com/en/index.asp

I appreciate any help..

Thanks, TheFoot
Sep 30 '07 #1
4 4479
drhowarddrfine
7,435 Expert 4TB
The problem is that all those elements are part of the same class so changing the z-index gets applied to all that at the same time. The drop downs are getting covered up because the elements are floated which takes them out of the normal flow and allows the other elements to rise up into those positions.
Sep 30 '07 #2
Hi. Thanks for replying.

I think I understand what you are saying. I was advised that to subclass is better than using many classes. Was that good advice?

I have given the popup <ul> element a separate classname, rather than selectors.. what else do I need to give a class to to fix this?

Thanks for your help..

The problem is that all those elements are part of the same class so changing the z-index gets applied to all that at the same time. The drop downs are getting covered up because the elements are floated which takes them out of the normal flow and allows the other elements to rise up into those positions.
Sep 30 '07 #3
drhowarddrfine
7,435 Expert 4TB
By sub-classes, I assume you mean assigning a class to some parent element which contains other elements with their own class. That's fine but, in this case, it looks like those drop down elements are all part of the same class and just wrapping around inside their container. I haven't really looked close enough (just back from out of town).
Sep 30 '07 #4
Hi..

By sub-classing, I mean something like this:

[HTML]<style>
ul.top-menu-list{
/* styles */
}

ul.top-menu-list li a{
/* This is what I call sub-classed - it has no class name, but applies to <a> elements that have a parent <li> element, that are children of the ul.top-menu-list class. */
}

</style>[/HTML]
The <ul> that is the parent element for the popup list (the floated element) also has its own classname, but everything else inside it (<li>'s and <a>'s are subclassed.

Here is a rough example of how it is currently structured:

[HTML]<ul class='top-menu-list'>
<li>
<a href=''>Top Level Menu Item 1</a>
<ul class='popup-list'>
<li><a href=''>Popup menu item 1</a></li>
<li><a href=''>Popup menu item 2</a></li>
</ul>
</li>
</ul> [/HTML]

Thanks...

By sub-classes, I assume you mean assigning a class to some parent element which contains other elements with their own class. That's fine but, in this case, it looks like those drop down elements are all part of the same class and just wrapping around inside their container. I haven't really looked close enough (just back from out of town).
Sep 30 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: LG | last post by:
I have asked before but I did not get all the answer I wanted. Perhaps I explained too bad. I have my site in frames, and the dropdown list is in the 'left' frame, and I have used javascript so...
4
by: Tim | last post by:
Hi, I've been searching the web for hours now and found lots and lots of javascript files with which you can create dropdown menu's, but with all of them you have to specify the width of the...
3
by: ACaunter | last post by:
Hi there, can someone please tell me what the easiest way to have a dropdown menu bar positioned on the screen (eg. Home, company, ... , contact us) then when the mouse goes over then, the sub...
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
0
by: plunder | last post by:
Hi all what I'm trying to do is a flash menu which in some points has a dropdown sub-menu which comes out on mouseover and contains elements which if clicked link to other pages. Point is that these...
0
by: temp304 | last post by:
Customize Dropdown Menu is designed to display some choices, as: languages, countries, themes,... but it's differrent from original version in browsers. This tool combine CSS and JavaScript to create...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
1
by: dittu | last post by:
I want to design dropdown menu.This menu contains two item(save,saveContent).When mouse over on Menu then display below like that ____________ Menu | -------------| Save | SaveContent |...
0
by: Helena Tran | last post by:
I'm doing a dropdown-menu, and combine JS. It's display well in all browser, but it has an error when displaying in IE 7,8 browser: Menu dropdown in normal : ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.