主体中的容器与我的侧面导航重叠

时间:2017-09-26 15:55:39

标签: html css

这是我的侧面导航代码

<style>

    /* The side navigation menu */

    .sidenav {

        height: 50%; /* 100% Full-height */

        width: 0; /* 0 width - change this with JavaScript */

        position: fixed; /* Stay in place */

        z-index: 50; /* Stay on top */

        top: 0;

        right: 0;

        background-color: #111; /* Black*/

        overflow-x: hidden; /* Disable horizontal scroll */

        padding-top: 60px; /* Place content 60px from the top */

        transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */

    }



    /* The navigation menu links */

    .sidenav a {

        padding: 8px 8px 8px 32px;

        text-decoration: none;

        font-size: 12px;

        color: #818181;

        display: block; 

        transition: 0.3s

    }



    /* When you mouse over the navigation links, change their color */

    .sidenav a:hover, .offcanvas a:focus{

        color: #f1f1f1;

        background:#3797dd;

    }



    /* Position and style the close button (top right corner) */

    .sidenav .closebtn {

     top:0;

     right:25px;

     padding: 8px 8px 8px 32px;

     text-decoration: none;

     font-size: 12px;

     color: #818181;

     display: block;

     transition: 0.3s

   /* position: absolute;

    top: 0;

    right: 25px;

    font-size: 36px;

    margin-left: 50px;*/

}
/* Style page content - use this if you want to push the page content to the right when you open the side navigation */

#main {

    transition: margin-left .5s;

    padding: 20px;

}



/* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */

@media  screen and (max-height: 450px) {

    .sidenav {padding-top: 15px;}

    .sidenav a {font-size: 18px;}

}   

</style>

查看www.dev.zulwa.com

2 个答案:

答案 0 :(得分:0)

将此添加到您的CSS:

.navbar {z-index : 99999 }

答案 1 :(得分:0)

这是我的HTML代码

  •             ×关闭             代理查找器             ZULWA如何运作             联系我们                                  
          <a style="height: 40px; margin-top: -15px;"><span style="font-size:13px; cursor:pointer" onclick="openNav()"><span>&#9776;</span> </span></a>
    
          <script>
            function openNav() {
              document.getElementById("mySidenav").style.width = "250px";
            }
    
            function closeNav() {
              document.getElementById("mySidenav").style.width = "0";
            }
    
            function openNav() {
              document.getElementById("mySidenav").style.width = "250px";
              document.body.style.backgroundColor = "rgba(0,0,0,0.8)";
            }
    
            /* Set the width of the side navigation to 0 */
            function closeNav() {
              document.getElementById("mySidenav").style.width = "0";
              document.body.style.backgroundColor = "white";
            }
          </script>
        </li>