个性化阅读
专注于IT技术分析

如何在WordPress中制作Pure CSS3平滑下拉菜单?

我正在制作bootsword的wordpress主题, 并且在像本例这样的主菜单中添加纯平滑的下拉菜单效果时遇到问题, 例如单击” M logo”以打开下拉菜单后, 它似乎无法正常工作。你可以在此链接上查看我的主题以获取更多详细信息

这是我目前的CSS类:

.navbar-nav>li>.dropdown-menu {
    margin: -1px 0 0 45%;
    border-top-right-radius: 0;
    border-top-left-radius: 0;

}

.dropdown-menu {
    /* background: url(img/submenu.png) no-repeat scroll right/ 91% 100%; */
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 153px;
    padding: 1px 0;
    margin: 2px 0 0 0;
    list-style: none;
    font-size: 14px;
    text-align: center;
    background-color: #5c4d4a;
    border: 1px solid #ccc;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    background-clip: padding-box;

}

.dropdown-menu li a {
    display: block;
    background: url(img/submenu.png) no-repeat scroll right/ 104% 108%;
    padding: 10px 20px;
    clear: both;
    font-weight: normal;
    line-height: 1.428571;
    color: #fff;
    white-space: nowrap;

}
.dropdown-menu li a:hover, .dropdown-menu li a:focus {
    background: url(img/submenu.png) no-repeat scroll right/ 104% 108%;
    color: #ccc;
    text-decoration: none;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
      -webkit-transition: all .25s ease;
       -moz-transition: all .25s ease;
        -ms-transition: all .25s ease;
         -o-transition: all .25s ease;
            transition: all .25s ease;
}

.dropdown-menu ul { 

list-style: none; 

}

#1


所需的主要功能是:

.dropdown-menu {
    opacity: 0;
    position: absolute;
    top: 35px;
    visibility: hidden;
    -webkit-transition: all .25s ease;
       -moz-transition: all .25s ease;
        -ms-transition: all .25s ease;
         -o-transition: all .25s ease;
            transition: all .25s ease;
}
nav li:hover .dropdown-menu {
    opacity: 1;
    top: 50px;
    visibility: visible;
}

float:left是一个伪狂, 它被position:absolute覆盖;

赞(0)
未经允许不得转载:srcmini » 如何在WordPress中制作Pure CSS3平滑下拉菜单?

评论 抢沙发

评论前必须登录!