CSS - Css Drop-down Menu Issue
Can somebody please look at the following drop-down menu and tell me why it breaks in IE...it works fine in Mozilla/FF...
In IE, the problem is that the sub-menus do not completely appear in front of their parent menus...they should be on top of their parent menus...like i said, it works in FF, so you can switch bewteen browsers to see the difference.... Thanks for any help. __________________ R.J. www.mediamogulsweb.com Similar TutorialsOk, I'm using wordpress theme SLR Lounge V2, and am trying to modify it to suit my needs. The problem I'm having is with my navigation's drop down menu. I'm currently using a custom menu (wordpress functionality, not theme). Initially, there was no background behind the drop down at all (so you couldn't really read it), which I've managed to modify to get the colour I want, however, I don't want the gaps, and I want it all to line up flush on the right hand side. Here's a screenshot of what I'm talking about: http://i.imgur.com/uSn1i.jpg I've played with padding etc to no avail. Also, sometimes the navigation elements end up paired beside each other instead of a straight vertical list if I play with the padding. Here is the css I have relating to the drop down navigation: Code: /* Start Menu Items */ #menu { list-style:none; margin:0; padding:0; width:1000px; height:100%; border:none; } #menu:after { content:''; display:block; clear:both; } #menu li.hover a,#menu li:hover a,#menu li.hover,#menu li:hover { position: relative; } #menu li.hover ul, #menu li:hover ul { display: block; } /*start drop-down menus on the top menu*/ #menu ul { padding:0; margin:0 0 0 -10px; list-style:none; width:108px; display: none; /*******if you delete this, your drop down menu will appear randomly on the page somewhere **/ position: absolute; } #menu ul li a { /*This is the drop down stufff */ text-align:left; float:right; http://www.freewebs.com/dmorand/NMI%20Web.htm That's what I've done so far, but the drop-down menu isn't displaying in IE, but it does in Firefox. Anyone have any ideas? Also, in Firefox I see a couple of dashes in the top left corner, that I don't see in IE. If you look at the main menu(Home-About MCAEC-The Academy-Adult Education-Shining Star-Giving) on this page and hover over one of the parent categories you'll see issues with the positioning of the dropdown. I adjusted the margin and it looks fine in IE but the dropdown floats over the parent tabs in Firefox and Opera. Is there a way to adjust this so it's consistent in all browsers? Here's the code for the dropdown ul ul li a: Code: #dropmenu { z-index:100; position:relative;} #dropmenu .menu ul ul {z-index:99; margin:0; width:160px; background:url(images/bg_sub.png) top left no-repeat !important; margin: 10px 0px 0px 0px ; position: absolute; display:none; padding-bottom:10px !important; clear:both; padding-top:13px;} #dropmenu .menu ul ul li { line-height:inherit; height:auto; text-align:left; width:160px; text-align:left; line-height:1.69em;} #dropmenu .menu ul ul li a{ font-weight: normal; color:#fff; font-size:13px; text-transform:none; } #dropmenu .menu ul ul li a:hover { color:#edc951; font-weight:normal; } Thanks Hi everyone, I am having an issue with IE7 (imagine that) with a css drop down nav menu. On IE8 and Chrome the menus work flawlessly but in on IE7 the menu is behind the pictures on the page. The page is located at www.philadler.com/newlayout2.php. At first I thought it may be a z-index problem but the nav bar is set to 1000 and 900 depending on the menu and the thumbnails are set to 100. As of now the site validates on both css and xhtml 1.0 transitional. I can list any code if needed. Thanks for any help Phil I have a drop down menu that is working fine in FF 3.5 but not in IE 7. Will you please have a look at it and help me find out where the conflict is? I am thinking it is a CSS issue but it may also be a javascript issue. The menu is he http://bit.ly/42iVkG and the menu script I used is he http://bit.ly/4pvcXj Thank you. Hello everyone, I have a drop-down menu that is currently working well. The only change I need to make is to have the right edge of the drop-down menu to align with the right edge of the parent menu. When you hover over the menu, it currently "drops" down and to the right, with the left edges aligned. I want the menu to "drop" down and to the left, so the right edges are aligned. I have tried fiddling with floats and absolute/relative positioning. I'm not sure what needs to be changed. Any help you can provide is greatly appreciated! I'm learning via "cut and paste", so please go easy on any terminology you may use. Thank you! Here is the page: http://www.littlebuddymedia.com/site05/012.html The menu currently drops like this (aligned along the left edge): http://www.justskins.com/wp-content/uploads/2008/12/drop-down-menu.gif I want the menu to do this (align along the right edge; see how "Artists" is aligned under "Music" along the right edge): http://artatm.com/wp-content/uploads/2009/11/mtvmenu.JPG Here is my code: Code: .chromestyle{ width: 100%; font-weight: bold; float: left; height: 29px; } .chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .chromestyle ul{ border: 0px solid #BBB; width: 100%; background: url(chromebg.gif) center center repeat-x; /*THEME CHANGE HERE*/ padding: 4px 0; margin: 0; text-align: right; /*set value to "left", "center", or "right"*/ } .chromestyle ul li{ display: inline; } .chromestyle ul li a{ color: #000000; padding: 4px 7px; margin: 0; text-decoration: none; border-left: 1px solid #DADADA; } .chromestyle ul li a:hover, .chromestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/ background: url(chromebg-over.gif) center center repeat-x; /*THEME CHANGE HERE*/ } /* ######### Style for Drop Down Menu ######### */ .dropmenudiv{ position:absolute; top: 0; border: 1px solid #BBB; /*THEME CHANGE HERE*/ border-bottom-width: 0; font:normal 12px Verdana; line-height:18px; z-index:100; background-color: white; width: 200px; visibility: hidden; } .dropmenudiv a{ width: auto; display: block; text-indent: 3px; border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/ padding: 2px 5px; text-decoration: none; font-weight: bold; color: black; } * html .dropmenudiv a{ /*IE only hack*/ width: 100%; } .dropmenudiv a:hover{ /*THEME CHANGE HERE*/ background-color: #0000ff; color: #fff200; } Following sample is from http://www.code-couch.com/jeff/snippets/general/tektips-navigation-example.html is what I am trying to reference to create a template. But how do I how keep the state of Menu on each requested page any help is appreciated. The following menu is saved in a separate jsp file i.e. navs.jsp. I include this navigation jsp file in all of my files. Initially the drop down looks like: Code: . Ask.Jeeves . [+] Google.com . [+] Yahoo.com Now clicking [+] in front of Google.com will look like. Code: . Ask.Jeeves . [-] Google.com . Google.co.ie . Google.co.ie . [+] Google.co.nz . [+] Yahoo.com Lets's say now if I click on Google.co.ie it takes me to sample.jsp and on this requested page (sample.jsp) how can I show the following menu hierarchy with Google.co.ie bold/underlined/colorchanged showing what menu content I clicked and am viewing the appropriate content i.e. Code: . Ask.Jeeves . [-] Google.com . Google.co.ie . Google.co.ie . [+] Google.co.nz . [+] Yahoo.com Same way clicking Google.com or Yahoo.com or Ask.Jeeves shows you the following hierarchy on the requested page with higlight/bold/colored the link we just selected. i.e. Code: . Ask.Jeeves . [+] Google.com . [+] Yahoo.com Any time clicking on the menu takes me to some page but on that page I want to show th hierarchy of the menu all the way to which is recently clicked with different color setting. Here is the source for the above: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <meta http-equiv="content-language" content="en"/> <title>Test Harness</title> <style type="text/css"> ul li ul {display:none;list-style-type: none;} #myNav li a:hover { color: blue; } #myNav li a:active { color: #FF0000; background: #FFFFFF; } #myNav { list-style-image: url(page.GIF); } </style> <script type="text/javascript"> <!-- function initNav() { var navObj = document.getElementById('myNav'); var ulCollection = navObj.getElementsByTagName('li'); for (var loop = 0; loop < ulCollection.length; loop++) { if(ulCollection[loop].getElementsByTagName('ul').length > 0) { /* we have an LI that contains a UL */ if (ulCollection[loop].getElementsByTagName('span').length > 0) { /* there is at least one SPAN tag present */ ulCollection[loop].getElementsByTagName('span')[0].innerHTML = "[<a href=\"javascript://\" onclick=\"this.innerHTML=this.innerHTML=='+'?'-':'+';temp=this.parentNode.parentNode.getElementsByTagName('ul')[0].style;temp.display=temp.display=='block'?'none':'block';\">+</a>] "; } } } } window.onload = initNav; //--> </script> </head> <body> <ul id="myNav"> <li><a href="http://www.askjeeves.com">Ask.Jeeves</a></li> <li><span></span><a href="http://www.google.com">Google.com</a> <ul> <li><a href="http://www.google.co.uk">Google.co.uk</a></li> <li><a href="http://www.google.co.ie">Google.co.ie</a></li> <li><span></span><a href="http://www.google.co.nz">Google.co.nz</a> <ul> <li>*3*</li> <li>*4*</li> </ul> </li> </ul> </li> <li><span></span><a href="http://www.yahoo.com">Yahoo.com</a> <ul> <li><a href="http://www.yahoo.co.uk">Yahoo.co.uk</a></li> <li><a href="http://www.yahoo.co.nz">Yahoo.co.nz</a></li> </ul> </li> </ul> </body> </html> Any help is really appreciated thanks. EDIT:: Simplier way to write the question ^.^ :: When I scroll off the menu/link onto the first link in the submenu it stays, but when I mvoe down to the next item in the submenu it disappears. (My drop down is vertically aligned on the left.) (bits of the code that relate to the menu) PHP Code: .btn1 { position: absolute; left: 165px; top: 200px; } .btn2 { position: absolute; left: 165px; top: 240px; } .btn3 { position: absolute; left: 165px; top: 280px; } .btn4 { position: absolute; left: 165px; top: 320px; } .btn5 { position: absolute; left: 165px; top: 360px; } .btn6 { position: absolute; left: 165px; top: 400px; } .btn7 { position: absolute; left: 165px; top: 440px; } .btn8 { position: absolute; left: 165px; top: 480px; } .link1 { position: absolute; left: auto; top: 240px; } .link2 { position: absolute; left: auto; top: 280px; } .link3 { position: absolute; left: auto; top: 320px; } .link4 { position: absolute; left: auto; top: 360px; } .link5 { position: absolute; left: auto; top: 400px; } .link6 { position: absolute; left: auto; top: 440px; } .link7 { position: absolute; left: auto; top: 480px; } .link8 { position: absolute; left: auto; top: 520px; } .link9 { position: absolute; left: auto; top: 560px; } #nav, #nav ul { padding: 0; margin: 0; list-style: none; } #nav a { display: block; width: 100px; } #nav li { width: 100px; } #nav li ul { position: absolute; width: 100px; left: -9999px; display: none; top: 0; z-index: 3; } #nav li:hover ul { display: block; left: 266px; z-index: 3; } #nav li:over ul { display: block; left: 266px; z-index: 3; } PHP Code: <ul id="nav"> <li><a href="HOBmain.htm"><img class="btn1" src="../mainbtn.gif" width="100" height="38" alt="MainBtn"></a></li> <li><a href="HOBmain.htm"><img class="btn2" src="../blogbtn.gif" width="100" height="38" alt="BlogBtn"></a> <ul> <li class="link1"><a href=""><img src="../mbtn.gif" alt="bMainBtn"></a></li> <li class="link2"><a href="#"><img src="../anmbtn.gif" alt="bAnimeBtn"></a></li> <li class="link3"><a href="#"><img src="../mgabtn.gif" alt="bMangaBtn"></a></li> <li class="link4"><a href="#"><img src="../gmebtn.gif" alt="bGameBtn"></a></li> <li class="link5"><a href="#"><img src="../bookbtn.gif" alt="bBookBtn"></a></li> </ul> </li> <li><a href="HOBmuse.htm"><img class="btn3" src="../musebtn.gif" width="100" height="38" alt="MuseBtn"></a> <ul> <li class="link2"><a href="HOBmuse.htm"><img src="../mbtn.gif" alt="mMainBtn"></a></li> <li class="link3"><a href="HOBmuse.htm"><img src="../pmbtn.gif" alt="mPoemBtn"></a></li> <li class="link4"><a href="HOBmuse.htm"><img src="../stybtn.gif" alt="mStoryBtn"></a></li> <li class="link5"><a href="HOBmuse.htm"><img src="../drmbtn.gif" alt="mDreamBtn"></a></li> </ul> </li> <li><a href="HOBodd.htm"><img class="btn4" src="../oddbtn.gif" width="100" height="38" alt="ComicBtn"></a> <ul> <li class="link3"><a href="HOBodd.htm"><img src="../mbtn.gif" alt="cMainBtn"></a></li> </ul> </li> <li><a href="HOBart.htm"><img class="btn5" src="../artbtn.gif" width="100" height="38" alt="ArtBtn"></a> <ul> <li class="link4"><a href="HOBart.htm"><img src="../mbtn.gif" alt="aMainBtn"></a></li> <li class="link5"><a href="HOBart.htm"><img src="../recbtn.gif" alt="aRecentBtn"></a></li> <li class="link6"><a href="HOBart.htm"><img src="../gaibtn.gif" alt="aGaiaBtn"></a></li> </ul> </li> <li><a href="HOBpic.htm"><img class="btn6" src="../picbtn.gif" width="100" height="38" alt="PicsBtn"></a> <ul> <li class="link5"><a href="HOBpic.htm"><img src="../mbtn.gif" alt="pMainBtn"></a></li> <li class="link6"><a href="HOBpic.htm"><img src="../recbtn.gif" alt="pRecentBtn"></a></li> </ul> </li> <li><a href="HOBfaq.htm"><img class="btn7" src="../faqbtn.gif" width="100" height="38" alt="FaqBtn"></a></li> <li><a href="HOBcon.htm"><img class="btn8" src="../contactbtn.gif" width="100" height="38" alt="ContactBtn"></a> </li> </ul> <script type="text/javascript" src="drop_down.js"></script> the "nav" is referring to a bit of js, and this is in my header. Also not sure if it's correct, but I can worry about that later. link: The Page Hi all, I've got a horizontal menu that is working just fine in every browser but IE 6 and 7. In IE it's almost there, except that the submenus will only appear one level deep. The menu is created with nested lists. The :hover functionality is simulated via JavaScript for IE 6. The IE developer toolbar shows the 3rd level menu is correctly being changed to display: block when its parent is hovered, and the border the dev toolbar draws even puts it in the correct place, it just doesn't actually appear. You can find the page he http://www.perceptes.com/topdog/ The CSS and JS (uses jQuery) can be found he http://www.perceptes.com/topdog/css/screen.css http://www.perceptes.com/topdog/css/ie.css (loaded with a conditional comment) http://www.perceptes.com/topdog/js/tdps.js http://www.perceptes.com/topdog/js/ie.js (loaded with a conditonal comment) For a specific example of what I'm talking about, try hovering over the second item, Filters & Parts. This will give you another level with four choices. Each of those also has child elements, but when hovered over, the next level doesn't appear. Try it in something other than IE 6 or 7 to see how it's supposed to look. Thanks very much in advance! I working on a CSS to display a round-shouldered-tab menu. My result is acceptable: http://rickduley.webs.com/roundShoulderTabMenu.jpg except for the fact that the tabs are set below the menuBar on which the are supposed to display. I have run out of ideas. Would someone please set me on the right path? Thanks. P.S.: the code is at http://rickduley.webs.com/roundShoulderTabMenu.zip.kgb - you have to delete the 'dot key gee bee' suffix. Hitting the IE6 wall. The menu is pure CSS and works fine in all browsers except IE6 (and Im sure below).. It doesn't display the drop down at all in IE6.. Link to site: (for anyone who can help) rs.vuemarketing.com Hey all, k, been banging my head off the desk for a while with this one. I'm using the same coding/styling for this menu as i am with all my currently working menus, but no dice in IE. The only difference with this, is that there are two drop-down menus...one on either side of the screen. here's the page in question. here's the menu; Code: <div id="leftmenu"><!-- OPEN LEFT MENU --> <ul id="leftnav"> <li><a href="#" class="imglink"><img src="images/leftmenu_top.gif" alt="Hover for Menu"></a> <ul> <li><a href="#" class="menus left imglink">home</a></li> <li><a href="#" class="menus left imglink">member zone</a></li> <li><a href="#" class="menus left imglink">birthday parties</a></li> <li><a href="#" class="menus left imglink">group parties</a></li> <li><a href="#" class="menus left imglink">contests</a></li> <li><a href="#" class="menus left imglink">location/hours</a></li> <li><a href="#" class="menus left imglink">prices</a></li> <li><a href="#" class="menus left imglink">specials</a></li> <li><a href="#" class="menus left imglink">lock-ins</a></li> <li><a href="#" class="menus left imglink">photo gallery</a></li> <li><a href="#" class="menus left imglink">links</a></li> <li><a href="#" class="menus left imglink">contact us</a></li> </ul> </li> </ul> </div><!-- CLOSE LEFT MENU --> <div id="rightmenu"><!-- OPEN RIGHT MENU --> <ul id="rightnav"> <li><a href="#" class="imglink"><img src="images/rightmenu_top.gif" alt="Hover for Menu"></a> <ul> <li><a href="#" class="menus right imglink">go-karts</a></li> <li><a href="#" class="menus right imglink">glo golf</a></li> <li><a href="#" class="menus right imglink">laser tag</a></li> <li><a href="#" class="menus right imglink">arcade</a></li> <li><a href="#" class="menus right imglink">batting cages</a></li> </ul> </li> </ul> </div><!-- CLOSE RIGHT MENU --> the css; Code: #leftmenu { float:left; position:absolute; left:0; top:20px; background:black; height:30px; width:150px; z-index:200; } #rightmenu { float:right; position:absolute; right:0; top:20px; background:black; height:30px; width:150px; z-index:200; } /* CONSOLIDATED NAVIGATION */ ul#leftnav { list-style:none; width:150px; } ul#rightnav { list-style:none; width:150px; } ul li { position: relative; } #rightmenu li ul { position:absolute; right:0; top:30px; width:135px; display: none; list-style:none; } #leftmenu li ul { position:absolute; left:0; top:30px; width:135px; display: none; list-style:none; text-align:right; } ul li a { display: block; text-decoration:none; color:white; } #rightmenu li:hover ul, li.over ul { display: block; border-bottom:1px solid #FD4467; border-left:1px solid #FD4467; } #leftmenu li:hover ul, li.over ul { display: block; border-bottom:1px solid #FD4467; border-right:1px solid #FD4467; } a.menus { color:white; text-decoration:none; padding:3px 0; } a.menus:hover { color:black; text-decoration:none; background-color:#D9FD02; border-top:1px solid #FD4467; border-bottom:1px solid #FD4467; padding:2px 0; } a.right:hover { border-right:10px solid #FD4467; } a.left:hover { border-left:10px solid #FD4467; } /* Fix IE. Hide from IE Mac \*/ * html #rightmenu ul li { float: right; } * html #rightmenu ul li a { height: 1%; } /* End */ /* Fix IE. Hide from IE Mac \*/ * html #leftmenu ul li { float: left; } * html #leftmenu ul li a { height: 1%; } /* End */ /* END MENUS */ and, just for good measure, the javascript, which is currently only setup for one side of the menu, just to get it rolling. Code: <script type="text/javascript"> <!-- startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("leftnav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; //--> </script> any help'd be greatly appreciated. I have a horizontal menu that drops vertically when you hover over a menu item. In IE7, the menu hides behind images making it invisible if it drops in a spot where an image is at. I haven't been able to find the answer to my problem, so I'm hoping someone here is familiar with this issue. I should mention it works in Firefox, but I haven't tested any other browsers. How easy is it to create one of these where when you hover over a link a menu appears underneath? I am looking for help with creating a CSS drop down menu. I found an example online, but I am unable to make it work for my site. I am trying make a horizontal drop down menu, but the menu is being displayed vertically, can someone please help. Thanks Below are my codes: Code: CSS /********************** Header ***************************/ #header { margin: 0px 0px 0px 0px; background-image:url(images/header.jpg); width:717px; height:288px; position:relative; } #header-container { position: absolute; top: 1em; left: 1em; } #header ul{ background-color:#000000; width:711px; border: 3px solid #FFFFFF; display:block; top:255px; position:absolute; margin: 0px 0px 0px 0px; height:22px; padding:5px 0px 0px 0px; text-align:center; } #header a { text-align: center; display:block; border: 1px solid #555; white-space:nowrap; margin:0; padding: 0.3em; } #header a:link, #header a:visited, #header a:active /* menu at rest */ { color: white; background-color: #000000; text-decoration:none; } #header a:hover /* menu on mouse-over */ { color: #000000; background-color: #CCCCCC; text-decoration:none; } #header a.top_parent, #header a.top_parent:hover /* attaches down-arrow to all top-parents */ { background-image: url(navdown_white.gif); background-position: right center; background-repeat: no-repeat; } #header a.parent, #header a.parent:hover /* attaches side-arrow to all parents */ { background-image: url(nav_white.gif); background-position: right center; background-repeat: no-repeat; } #header ul { list-style:none; margin:0; padding:0; float:left; width:9em; /* width of all menu boxes */ /* NOTE: For adjustable menu boxes you can comment out the above width rule. However, you will have to add padding in the "#menh a" rule so that the menu boxes will have space on either side of the text -- try it */ } #header li { position:relative; min-height: 1px; /* Sophie Dennis contribution for IE7 */ vertical-align: bottom; /* Sophie Dennis contribution for IE7 */ } #header ul ul { position:absolute; z-index:500; top:auto; display:none; padding: 1em; margin:-1em 0 0 -1em; } #header ul ul ul { top:0; left:100%; } div#header li:hover { cursor:pointer; z-index:100; } div#header li:hover ul ul, div#header li li:hover ul ul, div#header li li li:hover ul ul, div#header li li li li:hover ul ul {display:none;} div#header li:hover ul, div#header li li:hover ul, div#header li li li:hover ul, div#header li li li li:hover ul {display:block;} Code: HTML <div id="container"> <div id="header"> <ul> <li><a href="index.html">Home</a></li> <li><a href="fbstats.html">Football</a></li> <li><a href="bbstats.html">Baseball</a></li> <li><a href="bio.html">Biography</a></li> <li><a href="televison.html">Television</a></li> <li><a href="cdbuy.html">CD/Book</a></li> <li><a href="video.html">Videos</a></li> </ul> </div> First let me start of with this for doing all this work for my drop down menu and then finding out that IE6 (apparently 50% of people browsing) doesn't support :hover except on anchor tags. Here is my situation. I finally got my drop down menu working. However, there are three issues. when I hover over the 'companies' menu item 1) the menu expands and pushes the 'blog' and 'contact' menu items further down the menu. I will say that I did not define a width on the li tags because this is actually for a wordpress theme and I wanted to allow for more pages that might be added later. I thought that by defining a width I would be more likely to fill up my menu container. 2) the child/nested li tags aren't under the parent li tag. Basically the sub-menu items show up to the bottom and right of the 'companies' menu item. I want them to show up directly underneath the parent menu item. 3) the longer sub-menu items (nested li tags) are not showing up on the same line. It's like there is a width that is causing them to overlap or go down to the next row. Not sure if that makes sense. I am wanting it to appear on one line no matter how long the menu item is. I am sure that not defining a width on the li tags have something to do with some of these problems but I wanted others to take a look at it. Code(validated) and styles below. Tried to keep it simple. there are two img files that I use as well but couldn't figure out how to upload those. Any and all help from the CSS gurus will be greatly appreciated. Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Drop Menu Test</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="access"> <div id="menu-container"> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Services</a></li> <li><a href="#">Compare</a></li> <li><a href="#">Companies</a> <ul> <li><a href="#">Company number one</a></li> <li><a href="#">Company 2</a></li> <li><a href="#">Company #3</a></li> <li><a href="#">Company number 4</a></li> </ul> </li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> </ul> </div><!--menu--> </div><!--menu-container--> </div><!--access--> </body> </html> Code: body{ background-color: #999; margin: 0; } ul,li { margin: 0; } div#access { margin: 0px; background-repeat: repeat-x; background-image: url(images/navbar-bckgrd.gif); } div#menu { height:1.5em; width:100%; margin-right: 0; margin-bottom: 0; margin-left: 0; } div#menu a { color: #FFF; text-decoration: none; } div#menu-container { width: 974px; margin-right: auto; margin-left: auto; height: 27px; margin-top: 0px; margin-bottom: 0px; } div#menu li { list-style-type: none; color: #FFF; position: relative; float: left; height: 27px; /*width: 6em;*/ font-size: 1.2em; line-height: 1em; } div#menu ul a { display:block; margin-right:1em; padding:0.2em 0.5em; } div#menu li a:hover { background-image: url(images/hover%20menu.jpg); background-repeat: repeat-x; } /*second teir*/ div#menu li ul { display: none; background-repeat: repeat; background-color: #CCC; margin: 0px; } div#menu li:hover ul { display: inline; float: left; width: 10em; height: auto; } div#menu li ul li { font-size: 0.9em; width: 7em; margin-left: 0px; } div#menu li ul li a { color: #000; margin-left: 0px; } div#menu li ul li a:hover { color: #FFF; } Hi, I have this drop down menu, but the parents are appearing under each other, instead of next to each other. I am trying to create a horizontal menu with sub items appear under the parent items. this is my code: PHP Code: #menu2 { width: 800px; float:left } #menu2 ul { list-style: none; margin: 0; padding: 0; width: 12em; float: left; } #menu2 a, #menu2 h2 { font: bold 11px/16px arial, helvetica, sans-serif; display: block; border-width: 1px; border-style: solid; border-color: #ccc #888 #555 #bbb; margin: 0; padding: 2px 3px; } #menu2 h2 { color: #fff; background: #000; text-transform: uppercase; } #menu2 a { color: #000; background: #efefef; text-decoration: none; } #menu2 a:hover { color: #a00; background: #fff; } #menu2 li {position: relative; float:left; width: 200px;} a.mainlevel{background-color: #000000!important; display:inline-block} #menu2 ul ul { position: absolute; z-index: 500; float:left } #menu2 ul ul ul { position: absolute; top: 0; } div#menu2 ul ul, div#menu2 ul li:hover ul ul, div#menu2 ul ul li:hover ul ul {display: none;} div#menu2 ul li:hover ul, div#menu2 ul ul li:hover ul, div#menu2 ul ul ul li:hover ul {display: block;} Can anyone see anything wrong? Many thanks The code is here on an old Proboards test site: http://kayaoti.proboards.com/index.cgi The menu in the black bar is just one I used from a free code. It works fine except when you hover over the items, the drop-down tabs are out of alignment. I'm not code-savvy enough to know how to make them drop straight down or how to move them so they look nicer, but I'm guessing someone here could help me out in that regard. How can I edit the code (shown below) or whatever else to make the drop-down tabs look better aligned with the menu items? Code: <style type="text/css" media="screen"> /**************** menu coding *****************/ #menu { width: 748px; background: #000; float: left; } #menu ul { list-style: none; margin: 0; padding: 0; width: 12em; float: left; } #menu h2 { color: #000; background: #000; text-transform: uppercase; } #menu a, #menu h2 { font: bold 11px/16px arial, helvetica, sans-serif; display: block; border-width: 1px; border-style: solid; border-color: #000 #000 #000 #000; margin: 0; padding: 2px 3px; } #menu a { color: #fff; background: #000000; text-decoration: none; } #menu a:hover { color: #fff; background: #000; } #menu li {position: relative;} #menu ul ul { position: absolute; z-index: 500; } #menu ul ul ul { position: absolute; top: 0; left: 100%; } div#menu ul ul, div#menu ul li:hover ul ul, div#menu ul ul li:hover ul ul {display: none;} div#menu ul li:hover ul, div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul {display: block;} </style> <!--[if IE]> <style type="text/css" media="screen"> #menu ul li {float: left; width: 100%;} </style> <![endif]--> <!--[if lt IE 7]> <style type="text/css" media="screen"> body { behavior: url(csshover.htc); font-size: 100%; } #menu ul li a {height: 1%;} #menu a, #menu h2 { font: bold 0.7em/1.4em arial, helvetica, sans-serif; } </style> <![endif]--> <div id="menu" style="position:relative; left:301px; top:483px;"> <ul><li><a href="http://dominionwolves.proboards.com/"><IMG SRC="http://i44.tinypic.com/24zb1vq.png" border="0"></a></li></ul> <ul><li><IMG SRC="http://i43.tinypic.com/311lyra.png" style="position:relative; left:-40px; top:2px;"> <ul> <li><a href="http://www.seoconsultants.com/tips/css/#cssmenus">CSS Hover Navigation</a> <ul> <li><a href="../css-dropdown-menus.html" title="tanfa Introduction">Intro for CSS Enthusiasts</a></li> <li><a href="index.html" title="Plain HTML Code">Demonstration HTML</a></li> <li><a href="http://www.xs4all.nl/~peterned/csshover.html" title="whatever:hover file">csshover.htc file</a></li> </ul> </li> </ul> </li> </ul> <ul> <li><IMG SRC="http://i39.tinypic.com/2cne1d5.png" style="position:relative; left:0px; top:2px;"> <ul> <li><a href="http://www.seoconsultants.com/tips/css/#cssmenus" title="SEO Consultants Directory">CSS Hover Navigation</a> <ul> <li><a href="../css-dropdown-menus.html" title="tanfa Introduction">Intro for CSS Enthusiasts</a></li> <li><a href="index.html" title="Plain HTML Code">Demonstration HTML</a></li> <li><a href="http://www.xs4all.nl/~peterned/csshover.html" title="whatever:hover file">csshover.htc file</a></li> </ul> </li> </ul> </li> </ul> <ul> <li><IMG SRC="http://i40.tinypic.com/24ffxu1.png" style="position:relative; left:55px; top:2px;"> <ul> <li><a href="http://www.seoconsultants.com/css/menus/vertical/" title="SEO Consultants Vertical Example">SEO Consultants Sample</a></li> <li><a href="vs7.html" title="Complete Example">tanfa Demo example</a> <ul> <li><a href="tutorial-v.html" title="Vertical Menu Tutorial">tanfa Tutorial</a> <ul> <li><a href="vs1.html" title="Vertical Menu - Page 1">Stage 1</a></li> <li><a href="vs2.html" title="Vertical Menu - Page 2">Stage 2</a></li> <li><a href="vs3.html" title="Vertical Menu - Page 3">Stage 3</a></li> <li><a href="vs4.html" title="Vertical Menu - Page 4">Stage 4</a></li> <li><a href="vs5.html" title="Vertical Menu - Page 5">Stage 5</a></li> <li><a href="vs6.html" title="Vertical Menu - Page 6">Stage 6</a></li> </ul> </li> </ul> </li> </ul> </li> </ul> <ul> <li><IMG SRC="http://i42.tinypic.com/15cerno.png" style="position:relative; left:65px; top:2px;"> <ul> <li><a href="http://www.seoconsultants.com/css/menus/horizontal/" title="SEO Consultants Directory Example">SEO Consultants Sample</a></li> <li><a href="hs7.html">tanfa Demo example</a><!-- fully working sample --> <ul> <li><a href="tutorial-h.html" title="Horizontal Menu Tutorial">tanfa Tutorial</a> <ul> <li><a href="hs1.html" title="Horizontal Menu - Page 1">Stage 1</a></li> <li><a href="hs2.html" title="Horizontal Menu - Page 2">Stage 2</a></li> <li><a href="hs3.html" title="Horizontal Menu - Page 3">Stage 3</a></li> <li><a href="hs4.html" title="Horizontal Menu - Page 4">Stage 4</a></li> <li><a href="hs5.html" title="Horizontal Menu - Page 5">Stage 5</a></li> <li><a href="hs6.html" title="Horizontal Menu - Page 6">Stage 6</a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </div> Hi, I am working on my site, and was wondering if anyone knew how to do a menu like this http://www.vh1.com/music/ The one on the left in blue.. how it turns to white. I am pretty sure this is done with css. Can anyone tell me how this is done? Thanks i m having problem in displaying menu and sub menu. pls check the code. HTML <html> <head> <title> List of Hospital values </title> <link href="new.css" rel="stylesheet" type="text/css"/> </head> <body> <ul id="navbar"> <li><a href="##">IPD Maintenance</a> <ul> <li><a href="#">Registration</a></li> <li><a href="#">Diagnose</a></li> <li><a href="#">Laboratary Test</a></li> </ul> </li> <li><a href="#">OPD Maintenance</a> <ul> <li><a href="#">Registration</a></li> <li><a href="#">Diagnose</a></li> <li><a href="#">Laboratary Test</a></li> <li><a href="#">Admission</a></li> <li><a href="#">Services </a></li> </ul> </li> <li><a href="#">Donation Management</a> <ul> <li><a href="">Donor detail</a></li> <li><a href="">Lab Test detail</a></li> <li><a href="#">Donor Medication</a></li> </ul> </li> <li><a href="#">Billing</a> <ul> <li><a href="#">IPD billing</a></li> <li><a href="#">OPD billing</a></li> </ul> </li> <li> <a href="#">Administrative Task</a> <ul> <li><a href="#">Manage user</a></li> <ul> <li><a href="#">Add User</a></li> <li><a href="#">Delete User</a></li> </ul> <li><a href="#">Manage Doctors</a></li> <ul> <li><a href="#">Edit Doctor</a></li> <li><a href="#">Add Doctor</a></li> <li><a href="#">Delete Doctor</a></li> </ul> <li><a href="#">Manage Staff</a></li> <ul> <li><a href="#">Edit Staff</a></li> <li><a href="#">Add Staff</a></li> <li><a href="#">Delete Staff</a></li> </ul> <li><a href="#">Manage Departments</a></li> <ul> <li><a href="##">Add Department</a></li> <li><a href="#">Delete Department</a></li> <li><a href="#">Edit Department</a></li> </ul> <li><a href="#">Manage Rooms</a></li> <ul> <li><a href="#">Add Room</a></li> <li><a href="#">Delete Room</a></li> <li><a href="#">Edit Room</a></li> </ul> </ul> </li> <li><a href="#">Laboratory</a> <ul> <li><a href="">Laboratory detail</a></li> <li><a href="">Lab Test detail</a></li> </ul> </li> <li><a href="#">Organ Management</a> <ul> <li><a href="">Laboratory detail</a></li> <li><a href="">Lab Test detail</a></li> </ul> </li> <li><a href="#">Blood Management</a> <ul> <li><a href="">Blood Taken</a></li> <ul> <li><a href="">Hospitals</a></li> <li><a href="">Donors</a></li> </ul> <li><a href="">Blood Endorsed</a></li> <ul> <li><a href="">Persons</a></li> <li><a href="">Hospitals</a></li> <li><a href="">IPD</a></li> </ul> </ul> </li> <li><a href="#">Emergency Services</a> <ul> <li><a href="">Estaff Detail</a></li> <li><a href="">Add Estaff</a></li> <li><a href="">Delete Estaff Detail</a></li> <li><a href="">Edit Estaff Detail</a></li> <li><a href="">Ambulance Detail</a></li> <li><a href="">Ambulance Route</a></li> </ul> </li> <li><a href="#">Inventory</a> <ul> <li><a href="">Suppliers</a></li> <li><a href="">Purchase Receipt</a></li> <li><a href="">Purchase return receipt</a></li> <li><a href="">Sales Receipt</a></li> <li><a href="">Sales Return Receipt</a></li> </ul> </li> </ul> </body> </html> AND THE CSS FILE IS AS FOLLOWING #navbar { margin: 0; padding: 0; height: 1em; } #navbar li { list-style: none; float: left; } #navbar li a { display: block; padding: 3px 8px; background-color: #5e8ce9; color: #fff; text-decoration: none; } #navbar li ul { display: none; width: 10em; /* Width to help Opera out */ background-color: #69f;} #navbar li:hover ul { display: block; position: absolute; margin: 0; padding: 0; } #navbar li:hover li { float: none; } #navbar li:hover li a { background-color: #69f; border-bottom: 1px solid #fff; color: #000; } #navbar li li a:hover { background-color: #8db3ff; } WAITING FOR YOUR HELP |