How to change drop-down menu to drop-up menu

ぐ巨炮叔叔 提交于 2019-12-25 06:44:12

问题


I have this menu bar: http://jsfiddle.net/PtQAP/ and I need to put it to the bottom and the drop-down menu change to drop-up menu. How would I do that?

css:

ul, li, a {
    margin: 0;
    padding: 0;
}
li {
    list-style: none;
}
a {
    text-decoration: none;
    color: #000000;
}

ul > li {
    float: left;
}
ul > li a {
    color: #fff;
    font-weight: bold;
    line-height: 40px;
    height:40px;
    display:block;
    padding:0px 10px;
}
ul li a:hover {
    background: #666666;
}
ul li ul {
    display: none;
    position: absolute;
    background: #333333;
}
ul li ul li {
    float: none;
    line-height: 40px;
    height: 40px;
}

Thanks for the answers.


回答1:


give the bar a position of fixed, and set its bottom to 0px, then set your menu to have a bottom of the height of your bar, in this case 40px

div {
    background: #999999;
    height: 40px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    color: #000000;
    margin: -8px;
    width:100%;
    position:fixed;
    bottom:0px;
    left:0px;
}

ul li ul {
    display: none;
    position: absolute;
    background: #333333;
    bottom:40px;
}

JSFiddle Demo



来源:https://stackoverflow.com/questions/23043151/how-to-change-drop-down-menu-to-drop-up-menu

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