html - CSS Drop Down Menu -> Cross Browser -
can of wonderful developers link or provide me link menu cross browser having issues mine , loading within firefox fine in chrome.
my div stays in correct position menu drops down below div.
my html dynamically generated , current structure is:
<nav id="mainmenu"> <ul> <li class="first"> <a href="#">single item</a> </li> </ul> <ul> <li class=""> <a href="#">drop down menu</a> <ul> <li class="first"> <a href="#">item 1</a> </li> <li class="last"> <a href="#">item 2</a> </li> </ul> </li> </ul>
my current css is:
#mainmenu{ height:50px; margin:0 auto 15px auto; background-color:#6a6a6a; -moz-border-radius:3px; -webkit-border-radius:3px; min-width: 800px; } #mainmenu ul{ display:inline; -webkit-border-bottom-right-radius:2px; -webkit-border-bottom-left-radius:2px; -moz-border-radius-bottomright:2px; -moz-border-radius-bottomleft:2px; } #mainmenu ul li{ margin-left:0px; width:120px; height:56px; float: left; list-style: none; position:relative; } #mainmenu li { float:left; display:block; text-decoration:none; width:120px; height:35px; font-size:13px; line-height:45px; text-align:center; color:#fff; text-transform:uppercase; padding-top:-4px; margin:0px; } #mainmenu li a:hover, #mainmenu li a:active{ text-decoration:none; background-color:#7a7a7a; color:#fff; width:120px; height:50px; -webkit-border-top-left-radius:2px; -webkit-border-bottom-left-radius:2px; -moz-border-radius-topleft:2px; -moz-border-radius-topleft:2px; } #mainmenu .signup { float: right; } #mainmenu .signup a{ background-color:#69c21c; height:50px; -webkit-border-top-right-radius:2px; -webkit-border-bottom-right-radius:2px; -moz-border-radius-topright:2px; -moz-border-radius-bottomright:2px; } #mainmenu li .signup a:hover{ background-color:#00afd8; } /*mainmenu sub menu */ #mainmenu ul li ul{ display: none; background-color:#7a7a7a; } #mainmenu ul li:hover ul{ text-transform:none; display:block; position:absolute; width:80px; top:50px; } #mainmenu ul li:hover ul a{ float:left; margin:0 0 0 -35px; line-height:35px; width:150px; height:35px; border:none; font-size:12px; text-align:left; text-transform:none; } #mainmenu ul li ul li a:hover{ width:115px; height:30px; font-weight:bold; margin-left:-35px; line-height:35px; }
update:
i have fixed li positional issue adding clear:both , float left, having issues trying dropdown li's height , width of li's:
#mainmenu{ clear:both; float:left; margin:0 auto 15px auto; padding:0; z-index:1000; position:relative; height:50px; background-color:#6a6a6a; -moz-border-radius:3px; -webkit-border-radius:3px; min-width: 800px; } #mainmenu ul{ display:inline; -webkit-border-bottom-right-radius:2px; -webkit-border-bottom-left-radius:2px; -moz-border-radius-bottomright:2px; -moz-border-radius-bottomleft:2px; } #mainmenu ul li{ margin-left:0px; width:120px; height:56px; float: left; list-style: none; position:relative; } #mainmenu li { float:left; display:block; text-decoration:none; width:120px; height:35px; font-size:13px; line-height:45px; text-align:center; color:#fff; text-transform:uppercase; padding-top:-4px; margin:0px; } #mainmenu li a:hover, #mainmenu li a:active{ text-decoration:none; background-color:#7a7a7a; color:#fff; width:120px; height:50px; -webkit-border-top-left-radius:2px; -webkit-border-bottom-left-radius:2px; -moz-border-radius-topleft:2px; -moz-border-radius-topleft:2px; } #mainmenu .signup { display:block; float:right; } #mainmenu .signup a{ background-color:#69c21c; height:50px; -webkit-border-top-right-radius:2px; -webkit-border-bottom-right-radius:2px; -moz-border-radius-topright:2px; -moz-border-radius-bottomright:2px; } #mainmenu li .signup a:hover{ background-color:#00afd8; } /*mainmenu sub menu */ #mainmenu ul ul{ display:none; /* sub menus hiden default */ position:absolute; top:2em; left:0; right:auto; /*resets right:50% on parent ul */ width:10em; /* width of drop-down menus */ background-color:#7a7a7a; } #mainmenu ul ul li{ left:auto; margin:0; clear:left; width:50%; } #mainmenu ul ul li a, #mainmenu ul li.active li a, #mainmenu ul li:hover ul li a, #mainmenu ul li.hover ul li { /* line required ie 6 , below */ font-weight:normal; /* resets bold set top level menu items */ line-height:1.4em; /* overwrite line-height value top menu */ } #mainmenu ul li:hover ul{ text-transform:none; display:block; position:absolute; width:155px; top:50px; } #mainmenu ul li:hover ul a{ float:left; margin:0 0 0 -35px; line-height:35px; width:150px; height:35px; border:none; font-size:12px; text-align:left; text-transform:none; } #mainmenu ul li ul li a:hover{ width:170px; height:30px; font-weight:bold; margin-left:-35px; line-height:35px; }
very menu http://matthewjamestaylor.com/blog/centered-dropdown-menus
quite minimal amount of code styling easy strip down , modify yourself
Comments
Post a Comment