重叠元素

时间:2014-04-07 19:45:19

标签: css overlap

在这个网站上http://nutritiousinfo.com我试图让菜单导航元素与标题重叠。我尝试将菜单的上边距更改为-35px,它看起来很好,直到我刷新它再次跳回来。这是标题和菜单部分的CSS:

#header {
    background: url(http://nutritiousinfo.com/wp-content/uploads/2014/04/Header.png);
    width: 960px; 
    height: 120px;
    margin: 10px auto 0;
    -moz-box-shadow: 0 0 0px #BBBBBB; 
    -webkit-box-shadow: 0 0 0px #BBBBBB;
    z-index: -1;
    }



#subnav .wrap {
    background: url(http://nutritiousinfo.com/wp-content/uploads/2014/04/NewNav.png);
    width: 960px;
    height: 70px;
    margin: -30px auto 0;
    clear: both;
    overflow: hidden;
    border-top: 0px solid #111111;
    -moz-box-shadow: 0 0 0px #BBBBBB; 
    -webkit-box-shadow: 0 0 0px #BBBBBB;
    z-index: 999999;
    }

1 个答案:

答案 0 :(得分:0)

尝试用以下方法替换您的实际保证金:

#subnav .wrap {
   margin: -35px auto 0px auto;
}

#subnav ul {
   width: 100%;
   float: left;
   list-style: none;
   margin: 0 !important;
   padding: 0 !important;
}

ul {
   margin: 0;
   padding: 0;
}