Blogger drop down menu

北城以北 提交于 2019-12-25 01:58:31

问题


This the Css code of my blogger template.

I tried to fix every detail but I still face problem... I can see the drop down menu when I hoover on the maim menu element but I can't click of the sub-menu items, when I try to hoover over the sub-menu window it disappears.

Could you please help me with that

.post {
    border:1px solid #000000;
    border-style:solid;
    border-radius:10px;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    background:#ffffff;
    margin:0.1em .5em;
    padding:0px 15px 0px 15px
}
.Header h1 {
    text-shadow: 4px 4px #191919;
}
/*----- MBT Drop Down Menu ----*/
#mbtnavbar {
    /* background: #a3a3a3; */
    width: 960px;
    color: #FFF;
    margin: 30px;
    padding: 0;
    position: relative;
    border-top:0px solid #000000;
    height: 5px;
}
#mbtnavbar {
    borderleft:0px solid #000000;
    border-right:0px solid #000000;
    border-bottom:0px solid #000000;
}
#mbtnav {
    background:#ededed;
    margin: 0;
    padding: 0;
}
#mbtnav ul {
    float:left;
    list-style: none;
    margin: 0;
    padding: 0;
}
#mbtnav li {
    list-style: none;
    margin: 0px;
    padding: 0px;
    /* border-left:1px solid #333; border-right:1px solid #333; */
    height:40px;
}
#mbtnav li a, #mbtnav li a:link, #mbtnav li a:visited {
    color: #000000;
    display: block;
    font:bold 22px Times new roman, Tahoma, Helvetica, FreeSans, sans-serif;
    margin: 0px;
    padding: 9px 12px 10px 12px;
    text-decoration: none;
}
#mbtnav li a:hover, #mbtnav li a:active {
    background: none;
    color: #000000;
    display: block;
    text-decoration: underline;
    margin: 0px;
    padding: 9px 12px 10px 12px;
}
#mbtnav li {
    float: left;
    padding: 0px;
}
#mbtnav li ul {
    z-index: 9999;
    position: absolute;
    left: -999em;
    height:160px;
    width: 170px;
    margin: 0px;
    padding: 0;
    border-bottom:1px solid #000000;
    border-top:1px solid #000000;
    border-right:1px solid #000000;
    border-left:1px solid #000000;
}
#mbtnav li ul a {
    width: 180px;
}
#mbtnav li ul ul {
    margin: -25px 0 0 161px;
}
#mbtnav li:hover ul ul, #mbtnav li:hover ul ul ul, #mbtnav li.sfhover ul ul, #mbtnav li.sfhover ul ul ul {
    left: -999em;
}
#mbtnav li:hover ul, #mbtnav li li:hover ul, #mbtnav li li li:hover ul, #mbtnav li.sfhover ul, #mbtnav li li.sfhover ul, #mbtnav li li li.sfhover ul {
    left: 295px;
}
#mbtnav li:hover, #mbtnav li.sfhover {
    position: static;
}
#mbtnav li li a, #mbtnav li li a:link, #mbtnav li li a:visited {
    background: #f1f1f1;
    /* width: 100px; */
    color: #000000;
    display: block;
    font:bold 14px Times new roman, Tahoma, Helvetica, FreeSans, sans-serif;
    margin: 0;
    padding: 9px 12px 10px 12px;
    text-decoration: none;
    z-index:9999;
    border-bottom:1px solid #000000;
}
#mbtnav li li a:hover, #mbtnavli li a:active {
    background: none;
    color: #000000;
    display:block;
    margin: 0;
    padding: 9px 12px 10px 12px;
    text-decoration: underline;
}
.tabs-inner .widget #mbtnavbar li a {
    border-left:none;
}
.tabs-outer .widget, .section {
    margin:0;
}
.tabs-inner {
    padding: 0px;
}

回答1:


The general idea toward a solution is to make the li elements be position:relative since they contain the submenu ul elements (which are absolutely positioned).

And the submenu ul elements should have left:0 or similar to place them adjacent to the parent element.

Adding position:relative; to rules #mbtnav li and #mbtnav li:hover, #mbtnav li.sfhover and also setting left: 0px; instead of left: 295px; on rules

#mbtnav li:hover ul, 
#mbtnav li li:hover ul, 
#mbtnav li li li:hover ul, 
#mbtnav li.sfhover ul, 
#mbtnav li li.sfhover ul, 
#mbtnav li li li.sfhover ul

results in a functioning menu.
Demo at http://jsfiddle.net/gaby/aX3hh/

For more help you will need to provide a working demo of you code..


update

After seeing the live site, the problem is with setting the height property with wrong values..

You need to

  • remove the height: 30px; from the #mbtnavbar rule
  • remove the height: 41px from the #mbtnav li rule
  • remove the height: 160px; from the #mbtnav li ul rule (and you will also want to remove the border-bottom:1px solid #000000; from this rule as well)

It should work fine after that



来源:https://stackoverflow.com/questions/22181931/blogger-drop-down-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!