Creating drop down UL navigation bar

前端 未结 2 1976
执笔经年
执笔经年 2020-12-22 11:32

Here is my code so far:

      
                
2条回答
  •  感动是毒
    2020-12-22 11:54

    Not even going into the CSS you need to enclose the secondary UL in the Home LI like below:

            
    

    CSS stolen from a quick tutorial:

    ul {
    font-family: Arial, Verdana;
    font-size: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    }
    ul li {
    display: block;
    position: relative;
    float: left;
    }
    li ul {
    display: none;
    }
    ul li a {
    display: block;
    text-decoration: none;
    color: #ffffff;
    border-top: 1px solid #ffffff;
    padding: 5px 15px 5px 15px;
    background: #1e7c9a;
    margin-left: 1px;
    white-space: nowrap;
    }
    ul li a:hover {
    background: #3b3b3b;
    }
    li:hover ul {
    display: block;
    position: absolute;
    }
    li:hover li {
    float: none;
    font-size: 11px;
    }
    li:hover a { background: #3b3b3b; }
    li:hover li a:hover {
    background: #1e7c9a;
    }   ​
    

    Demo: http://jsfiddle.net/calder12/7j6H9/

提交回复
热议问题