导航将延伸全宽和高度?

时间:2015-02-21 02:12:18

标签: html css navigation

我已经搜索并查看了这段代码,直到我脸色发青。我试图让导航扩展div(960px)的长度,并坐在图像滑块的下降。但无论我尝试它都不会工作。请帮助这个网站是一个重要的非营利组织:轮子上的餐点



.clearfix:after {
    display:block;
    clear:both;

}
 
/*----- Menu Outline -----*/
.menu-wrap {
    width:100%;
    box-shadow:0px 1px 3px rgba(0,0,0,0.2);
    background:#8498cb;

    
}
 
.menu {
    width:1000px;
    margin:0px auto;

}
 
.menu li {
    margin:0px;
    list-style:none;
    font-family:'Ek Mukta';


}
 
.menu a {
    transition:all linear 0.15s;
    color:#fff;


}
 
.menu li:hover > a, .menu .current-item > a {
    text-decoration:none;
    color:#000;
    
}
 
.menu .arrow {
    font-size:11px;
    line-height:0%;
}
 
/*----- Top Level -----*/
.menu > ul > li {
    float:left;
    display:inline-block;
    position:relative;
    font-size:19px;


}
 
.menu > ul > li > a {
    padding:10px 40px;
    display:inline-block;
    text-shadow:0px 1px 0px rgba(0,0,0,0.4);
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
}
 
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
    
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
 
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
    z-index:1;
    opacity:1;
}
 
.sub-menu {
    width:160%;
    padding:5px 0px;
    position:absolute;
    top:100%;
    left:0px;
    z-index:-1;
    opacity:0;
    transition:opacity linear 0.15s;
    box-shadow:0px 2px 3px rgba(0,0,0,0.2);
    background:#abc9f5;
}
 
.sub-menu li {
    display:block;
    font-size:16px;
}
 
.sub-menu li a {
    padding:10px 30px;
    display:block;
}
 
.sub-menu li a:hover, .sub-menu .current-item a {
    background:#e4e4e4;
}

<div class="menu-wrap">
    <nav class="menu">
        <ul class="clearfix">
           
            <li>
                <a href="#">Movies <span class="arrow">&#9660;</span></a>
 
                <ul class="sub-menu">
                    <li><a href="#">In Cinemas Now</a></li>
                    <li><a href="#">Coming Soon</a></li>
                    <li><a href="#">On DVD/Blu-ray</a></li>
                    <li><a href="#">Showtimes &amp; Tickets</a></li>
                </ul>
            </li>
            <li><a href="#">T.V. Shows</a></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">Site Help</a></li>
            <li><a href="#">Home</a></li>
        </ul>
    </nav>
</div>
&#13;
&#13;
&#13;

3 个答案:

答案 0 :(得分:0)

尝试:

.menu-wrap {
    width:100%;
    height: 100%;
    box-shadow:0px 1px 3px rgba(0,0,0,0.2);
    background:#8498cb;   
}

答案 1 :(得分:0)

这是你正在寻找的吗?

&#13;
&#13;
/*----- Menu Outline -----*/

body {
    margin:0;
    padding:0;
}

.menu-wrap {
    width:100%;
    box-shadow:0px 1px 3px rgba(0,0,0,0.2);
    background:#8498cb;
    padding:0;
    margin:0 auto;
}
 
.menu {
    width:100%;
    margin:0px auto;
    padding:0;
}
 
.menu ul {
    display:block;
    width:100%;
    margin:0px auto;
    padding:0;
    list-style:inline;
    height:42px;
    overflow:hidden;
}

.menu li {
    margin:0px;
    padding:0;
    font-family:'Ek Mukta';
    display:inline-block;
    height:42px;
}
 
.menu a {
    transition:all linear 0.15s;
    color:#fff;
}
 
.menu li:hover > a, .menu .current-item > a {
    text-decoration:none;
    color:#000;
}
 
.menu .arrow {
    font-size:11px;
}
 
/*----- Top Level -----*/
.menu > ul > li {
    float:left;
    display:inline-block;
    position:relative;
    font-size:19px;
}
 
.menu > ul > li > a {
    padding:10px 40px;
    display:inline-block;
    text-shadow:0px 1px 0px rgba(0,0,0,0.4);
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
}
 
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
 
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
    z-index:1;
    opacity:1;
}
 
.sub-menu {
    width:160%;
    padding:5px 0px;
    position:absolute;
    top:100%;
    left:0px;
    z-index:-1;
    opacity:0;
    transition:opacity linear 0.15s;
    box-shadow:0px 2px 3px rgba(0,0,0,0.2);
    background:#abc9f5;
}
 
.sub-menu li {
    display:block;
    font-size:16px;
}
 
.sub-menu li a {
    padding:10px 30px;
    display:block;
}
 
.sub-menu li a:hover, .sub-menu .current-item a {
    background:#e4e4e4;
}
&#13;
<div class="menu-wrap">
    <nav class="menu">
        <ul class="clearfix">
           
            <li>
                <a href="#">Movies <span class="arrow">&#9660;</span></a>
 
                <ul class="sub-menu">
                    <li><a href="#">In Cinemas Now</a></li>
                    <li><a href="#">Coming Soon</a></li>
                    <li><a href="#">On DVD/Blu-ray</a></li>
                    <li><a href="#">Showtimes &amp; Tickets</a></li>
                </ul>
            </li>
            <li><a href="#">T.V. Shows</a></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">Site Help</a></li>
            <li><a href="#">Home</a></li>
        </ul>
    </nav>
</div>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

这个问题的答案隐藏在代码中。真的很棘手。

&#13;
&#13;
.clearfix:after {
    display:block;
    clear:both;
    
}

.clearfix {
padding-left: 0;
}
 
/*----- Menu Outline -----*/
.menu-wrap {
    width: 960px;
    box-shadow:0px 1px 3px rgba(0,0,0,0.2);
    height: 42px;
    margin: auto;
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
 
.menu {
    width:960px;
    margin:0px auto;

}
 
.menu li {
    margin:0px;
    list-style:none;
    font-family:'Ek Mukta';


}
 
.menu a {
    transition:all linear 0.15s;
    color:#fff;


}
 
.menu li:hover > a, .menu .current-item > a {
    text-decoration:none;
    color:#000;
    
}
 
.menu .arrow {
    font-size:11px;
    line-height:0%;
}
 
/*----- Top Level -----*/
.menu > ul > li {
    float: left;
  display: inline-block;
position: relative;
font-size: 19px;
width: 192px;
text-align: center;


}
 
.menu > ul > li > a {
    padding: 10px 40px;
    display:inline-block;
    text-shadow:0px 1px 0px rgba(0,0,0,0.4);
}
 
.menu > ul > li:hover > a, .menu > ul > .current-item > a {
    
    background: url("navBg.png") repeat-x scroll left top #e4e4e4;
}
 
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
    z-index:1;
    opacity:1;
}
 
.sub-menu {
    width:160%;
    padding:5px 0px;
    position:absolute;
    top:100%;
    left:0px;
    z-index:-1;
    opacity:0;
    transition:opacity linear 0.15s;
    box-shadow:0px 2px 3px rgba(0,0,0,0.2);
    background:#abc9f5;
}
 
.sub-menu li {
    display:block;
    font-size:16px;
}
 
.sub-menu li a {
    padding:10px 30px;
    display:block;
}
 
.sub-menu li a:hover, .sub-menu .current-item a {
    background:#e4e4e4;
}
&#13;
<div class="menu-wrap">
    <nav class="menu">
        <ul class="clearfix">
           
            <li>
                <a href="#">Movies <span class="arrow">&#9660;</span></a>
 
                <ul class="sub-menu">
                    <li><a href="#">In Cinemas Now</a></li>
                    <li><a href="#">Coming Soon</a></li>
                    <li><a href="#">On DVD/Blu-ray</a></li>
                    <li><a href="#">Showtimes &amp; Tickets</a></li>
                </ul>
            </li>
            <li><a href="#">T.V. Shows</a></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">Site Help</a></li>
            <li><a href="#">Home</a></li>
        </ul>
    </nav>
</div>
&#13;
&#13;
&#13;