August 1, 201214 yr Hi there, I admit I haven't spent hours looking through the posts for a solution, but nevertheless I did have a quick look and what i found doesn't work for me. The problem is with a horizontal navigation and its hovering subnavigation blocks. To illustrate, here's a snapshot of it in Firefox, Chrome, ... ..and here's how it looks in ie: Notice how the submenu position is off to the right by X pixel.. the z-index problem is obvious Now the css: .navigation { position: absolute; bottom: 10px; left: 0; background-color:#0076a6; width: 100%; overflow: visible; } .navigation ul { list-style-type: none; margin-left: 215px;} .navigation ul li { display: block; float: left;} .navigation ul li span { border-right: 1px solid #fff; padding: 0 10px; } .navigation ul li a { border-right: 1px solid #fff; padding: 0 10px; } .navigation ul.level_2 li a, .navigation ul.level_2 li span {border: none;} .navigation ul.level_2 { position: absolute; top: -32768px; left: -32768px; z-index:1000; background-color: #0076a6;} .navigation ul li:hover ul.level_2 { top: auto; left: auto; margin: 0px; display: block;} .navigation ul.level_2 li {float: none;} Parent div of .navigation has a position: relative to it. The .navigation is in a 'nav' tag, containing the ul, and the list elements include the submenus (ul.level_2). About the z-index problem, I have tried to set the parent li, the parent ul and every bloody ancestor's z-index to a higher value as i've read somewhere that that should help, but it didnt't (same with setting position: relative).. I suppose this has something to do with the fact that the navigation's parent div is a sibling to the container div that contains that white background text. The other very annoying problem is the one with the top: auto and left: auto working somehow funny in ie.. why on earth is the submenu block offset to the right? let alone the fact that if anyone should manage to actually get into the submenu (which requires being quicker with your click-gun than jessie james), it disappears as soon as he/she goes for the lower menu points.. And I am left with the question: wtf? I would be very grateful if someone could come up with a plausible explanation of this phenomena, and ideas for a solution, or point me in the right direction if there has already been a post like this. The only thing I can think of at the moment is adjusting this behaviour with js..
August 1, 201214 yr Hi, I can see you are having a few issues with the code, I need to be able to see the html markup that you are using for the navigation as the css only gives half the picture. I have spent alot of time working on dropdown css based navigations so I think it would be easier for me to show you an example of a design I have recently developed, so here goes lol: When creating a multiple level dropdown menu I give each level link a class for example a.level1-btn this allows me to customise the way each level of buttons appears so here is my html markup including a little content and level 2 buttons: html: <div id="st-menubar"> <nav id="st-menu-case"> <ul id="st-menu"> <li><a href="#" class="single">Home</a><!-- Begin Home Item --> <div class="dropdown_2columns"><!-- Begin 2 columns container --> <div class="col_2"> <h2>Welcome !</h2> <p>Hi and welcome here ! This is a showcase of the possibilities of this awesome Mega Drop Down Menu.</p> <p>This item comes with a large range of prepared typographic stylings such as headings, lists, etc.</p> <h2>Cross Browser Support</h2> <img src="images/browsers.png" width="125" height="48" alt="" /> <p>This mega menu has been tested in all major browsers.</p> </div> </div><!-- End 2 columns container --> </li><!-- End Home Item --> <li><a href="#" class="single">Features</a><!-- Begin Feature Item --> <div class="dropdown_2columns"><!-- Begin 2 columns container --> <div class="col_2"> <ul> <li><a href="#" class="single-lv2">Module Positions</a></li> <li><a href="#" class="single-lv2">Module Styles</a></li> <li><a href="#" class="single-lv2">Typography</a></li> </ul> </div> </div><!-- End 2 columns container --> </li><!-- End Features Item --> </ul> </nav> </div> and the css: /*>=====<<[ MAIN NAVIGATION ]>>=====<*/ #st-menu-full{width:100%;height:80px;background:url(../images/body/menu-bg.png)0 0 repeat-x;} #st-menu-full #st-menubar{position:relative;top:-7px;margin-left:-10px;width:1020px;height:72px;background:url(../images/body/menu-panel.png)0 0 no-repeat;} #st-menu-full #st-menubar nav#st-menu-case ul#st-menu {margin-left:40px;width:960px;height:50px;display:block;} ul#st-menu li { float:left; display:block; text-align:center; position:relative; margin-right:30px; border:none; } ul#st-menu li a { font-family:Arial, Helvetica, sans-serif; font-size:14px; color: #EEEEEE; display:block; outline:0; text-decoration:none; text-shadow: 1px 1px 1px #000; } ul#st-menu li:hover a { color:#FFFFFF; text-shadow: 1px 1px 1px #999999; } .dropdown_1column, .dropdown_2columns, .dropdown_3columns, .dropdown_4columns, .dropdown_5columns { float:left; position:absolute; left:-999em; /* Hides the drop down */ text-align:center; padding:10px 5px 10px 5px; } .dropdown_2columns { margin-top:90px; margin-bottom:69px; margin-left:-70px; width: 310px; height:auto; background-image:url(../images/menus/main/dropdown-bg-mid.png); background-repeat:repeat-y; } .dropdown_2columns:before, .dropdown_2columns:after{ content:""; position:absolute; width:310px; background-repeat:no-repeat; left:0; } .dropdown_2columns:before{ background-image:url(../images/menus/main/dropdown-bg-top.png); height:90px; top:-90px; } .dropdown_2columns:after{ background-image:url(../images/menus/main/dropdown-bg-bottom.png); bottom:-69px;; height:69px; } .dropdown_1columns {width: 140px;} .dropdown_3columns {width: 420px;} .dropdown_4columns {width: 560px;} .dropdown_5columns {width: 700px;} ul#st-menu li:hover .dropdown_1column, ul#st-menu li:hover .dropdown_2columns, ul#st-menu li:hover .dropdown_3columns, ul#st-menu li:hover .dropdown_4columns, ul#st-menu li:hover .dropdown_5columns { left:-1px; top:30px; } .col_1, .col_2, .col_3, .col_4, .col_5 { display:inline; float: left; position: relative; margin-left: 5px; margin-right: 5px; } .col_1 {width:130px;} .col_2 {width:250px;height:auto;margin-top:-70px;padding-left:20px;padding-right:20px;} .col_3 {width:410px;} .col_4 {width:550px;} .col_5 {width:690px;} /*>=====>> LEVEL 1 BUTTONS <<=====<*/ /*> Background Image Load for all Button States & Sections <*/ a.single , a.single:before, a.single:after, a.single:hover, a.single:hover:before, a.single:hover:after, a.single:active, a.single:active:before, a.single:active:after {background-image:url(../images/body/menu/menu-button1.png);} /*> Before & After Only Settings <*/ a.single:before, a.single:after, a.single:hover:before, a.single:hover:after, a.single:active:before, a.single:active:after {content:""; position:absolute;height:47px;top:0;background-repeat:no-repeat;} /*> Inactive State <*/ a.single { position:relative; float:left; height:47px; width:60px; margin-left:50px; margin-top:3px; padding:0 5px; color:#fff; text-shadow:0 1px 0 #000; line-height:45px; background-position:0 0; background-repeat:repeat-x; } a.single:before { width:35px; right:-35px; background-position:0 -138px; } a.single:after { width:35px; left:-35px; background-position:0 -276px; } /*> Hover State <*/ a.single:hover { position:relative; float:left; height:47px; margin-left:50px; margin-top:3px; padding:0 5px; color:#09F; text-shadow:0 1px 0 #000; line-height:45px; background-position:0 -46px; background-repeat:repeat-x; } a.single:hover:before { width:35px; right:-35px; background-position:0 -184px; } a.single:hover:after { width:35px; left:-35px; background-position:0 -322px; } /*> Active State <*/ a.single:active { position:relative; float:left; height:47px; margin-left:50px; margin-top:0px; padding:0 5px; color:#0FF; text-shadow: 0 1px 0 #000, 0 0 5px #09F, 0 0 10px #09F; line-height:45px; background-position:0 -92px; background-repeat:repeat-x; } a.single:active:before { width:35px; right:-35px; background-position:0 -230px; } a.single:active:after { width:35px; left:-35px; background-position:0 -368px; } /*>=====>> LEVEL 2 BUTTONS <<=====<*/ /*> Background Image Load for all Button States & Sections <*/ a.single-lv2 , a.single-lv2:before, a.single-lv2:after, a.single-lv2:hover, a.single-lv2:hover:before, a.single-lv2:hover:after, a.single-lv2:active, a.single-lv2:active:before, a.single-lv2:active:after {background-image:url(../images/menus/main/level2button.png);} /*> Before & After Only Settings <*/ a.single-lv2:before, a.single-lv2:after, a.single-lv2:hover:before, a.single-lv2:hover:after, a.single-lv2:active:before, a.single-lv2:active:after {content:"";position:absolute;height:30px;top:0;background-repeat:no-repeat;} /*> Inactive State <*/ a.single-lv2 { position:relative; float:left; height:30px; width:140px; margin-left:10px; margin-top:10px; padding:0 5px; color:#999; text-shadow:0 1px 0 #000; line-height:30px; background-position:0 0; background-repeat:repeat-x; } a.single-lv2:before { width:50px; right:-50px; background-position:0 -150px; } a.single-lv2:after { width:50px; left:-50px; background-position:0 -350px; } /*> Hover State <*/ a.single-lv2:hover { position:relative; float:left; height:30px; margin-left:10px; margin-top:10px; padding:0 5px; color:#FFF; text-shadow:0 1px 0 #000; line-height:30px; background-position:0 -50px; background-repeat:repeat-x; } a.single-lv2:hover:before { width:50px; right:-50px; background-position:0 -200px; } a.single-lv2:hover:after { width:50px; left:-50px; background-position:0 -300px; } /*> Active State <*/ a.single-lv2:active { position:relative; float:left; height:30px; margin-left:10px; margin-top:10px; padding:0 5px; color:#000; text-shadow: 0 1px 0 #FFF; line-height:30px; background-position:0 -100px; background-repeat:repeat-x; } a.single-lv2:active:before { width:50px; right:-50px; background-position:0 -250px; } a.single-lv2:active:after { width:50px; left:-50px; background-position:0 -400px; } If you want to try out any of the code above then I have attached a working html/css design file for the code above by all means use what you need but add thanks if you do I couldnt upload a zip file so just make sure that the images go into the correct folders the file structure for all the images is present in the css. I hope this helps you. Charlie. p.s. I have included an image file showing the file structure of the design I have attached. Sorry for making it overly complicated . index.html style.css Edited August 1, 201214 yr by charlieh-starrtheme
Create an account or sign in to comment