December 9, 201114 yr Hello, Does anyone know how to fix a drop down menu that appears too far to the left when parent link is hovered? This is in IE9 - I havn't yet tested it in ie8 etc. Works great in FF, Crome etc. Below is the code for entire tab menu and drop down. Sorry its a bit long...! /* -----------------Tabs Navigation --- */ ul.tabs { display: block; margin: 0; padding: 0; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CFCFCF; } ul.tabs li { display: block; width: auto; height: 30px; padding: 0; float: right; margin-bottom: 0; } ul.tabs li a { display: block; text-decoration: none; width: auto; height: 29px; padding: 0px 20px; line-height: 30px; margin: 0; font-size: 15px; background-color: #EEE7D5; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0; border-left-width: 0; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #BCBCBC; border-right-color: #BCBCBC; border-bottom-color: #BCBCBC; border-left-color: #BCBCBC; color: #666; } ul.tabs li a.active { background: #fff; height: 30px; position: relative; top: -4px; padding-top: 4px; border-left-width: 1px; margin: 0 0 0 -1px; color: #111; -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } ul.tabs li:first-child a.active { margin-left: 0; } ul.tabs li:first-child a { border-width: 1px 1px 0 1px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } ul.tabs li:last-child a { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } ul.tabs-content { margin: 0; display: block; } ul.tabs-content > li { display:none; } ul.tabs-content > li.active { display: block; } ul.tabs:before, ul.tabs:after { content: '\0020'; display: block; overflow: hidden; visibility: hidden; width: 0; height: 0; } ul.tabs:after { clear: both; } ul.tabs { zoom: 1; } /*------------------- DROPDOWN ---*/ .tabs ul{ background: #FFF list-style:none; position:absolute; display: none; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: none; border-left-style: solid; border-top-color: #CCC; border-right-color: #CCC; border-bottom-color: #CCC; border-left-color: #CCC; width: 250px; top: 200px; } .tabs ul li{ padding-top:1px; float:none; } .tabs ul a{ white-space:nowrap; } .tabs li:hover ul{ /* ---------- Display the dropdown on hover--- */ background-color: #FFF; display: block; } .tabs li:hover a{ text-decoration:none; } .tabs li:hover ul a{ text-decoration:none; color:#666; font-size:14px; background-color:#ffffff; font-weight: normal; font-family: Arial, Helvetica, sans-serif; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #FFF; border-right-color: #FFF; border-bottom-color: #CCC; border-left-color: #FFF; } .tabs li:hover ul li a:hover{ /* Drop down menu hover */ color:#FFF; background-color:#9EADFE; font-weight: normal; font-family: Arial, Helvetica, sans-serif; width: auto; } .tabs ul li:first-child a { -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; border-top-right-radius: 0px; } .tabs ul li:last-child a { -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; border-top-left-radius: 0px; }
December 9, 201114 yr It won't work in IE8 - you're using :first-child, which is unsupported. You're right it is long! It can be done in about 10 lines, let me dig out the code... generally, the less code, the less there is to go wrong so it is probably a good idea to keep it smaller.
December 10, 201114 yr Author It won't work in IE8 - you're using :first-child, which is unsupported. You're right it is long! It can be done in about 10 lines, let me dig out the code... generally, the less code, the less there is to go wrong so it is probably a good idea to keep it smaller. Yes that would be fantasic - as you can proberly tell its about 2 different CSS menu designs kinda forced together! Client had to see design yesterday so didn't have time to slim it down. Or make it rignt in IE *sigh* Any suggestions would be great :-)
December 10, 201114 yr .menu div:hover .panel { display:block; } .panel { display:none; } <div class="menu"> <div> <a href="#">Linkylink</a> <div class="panel"> <a href="#">Sublinkylink</a> </div> </div> <div> <a href="#">Linkylink2</a> </div> </div> If you understand the above, it will make the whole thing much easier to craft yourself. Can't find the bookmark for complete one I'm afraid, but that is a good start. (I've used divs, but can be changed to ul li if you need)
Create an account or sign in to comment