2014-04-13 43 views
0

我有這個菜單欄:http://jsfiddle.net/PtQAP/ 我需要把它放在最下面,下拉菜單變成下拉菜單。 我該怎麼做?如何更改下拉菜單到下拉菜單

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; 
} 

感謝您的答案。

+0

可能[用PURE CSS向上/向上打開的下拉菜單]的副本(http://stackoverflow.com/questions/7814186/drop-down-menu-that-opens-up-upward-with-pure-css) – chris97ong

回答

3

給酒吧的fixed一個position,並設置其bottom0px,然後設置你的菜單中有你的酒吧的高度的bottom,在這種情況下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