Home > Back-end >  Side Bar - Position logout in menu
Side Bar - Position logout in menu

Time:06-28

I need move the Logout "button" for bottom in SideBar menu.

body{
    background: #526b62;
}
/* Sidebar */

#sidebar-wrapper{
    z-index: 1;
    position: absolute;
    width: 0px;
    height: 100%;
    overflow-y: hidden;
    background: #1c1c1c;/*#2C3E50;*/
    /*border: 2px solid red;*/
    
    /*opacity: 0.9;*/
}

#wrapper.MenuDisplayed #sidebar-wrapper{
    animation-duration: 2s;
    animation-name: side-wrapper;
    width: 250px;
    

}
#wrapper.MenuDisplayed #page-content-wrapper{
    animation-duration: 2s;
    animation-name: side-content;
    padding-left: 250px;
}

.wrapper-reverse{
    animation-duration: 2s;
    animation-name: side-wrapper-reverse;
}

.content-reverse{
    animation-duration: 2s;
    animation-name: side-content-reverse;
    padding-left: 0px;
}

@keyframes side-content {
  from {
    padding-left: 0px;
  }

  to {
    padding-left: 250px;
  }
}

@keyframes side-content-reverse {
  from {
    padding-left: 250px;
  }

  to {
    padding-left: 0px;
  }
}


@keyframes side-wrapper {
  from {
    width: 0px;
  }

  to {
    width: 250px;
  }
}
@keyframes side-wrapper-reverse {
  from {
    width: 250px;
  }

  to {
    width: 0px;
  }
}


/* Sidebar styling*/
.title-sidebar{
  display: flex;
  justify-content: center;
  font-size: 2em;
  color: #ddd;
  margin-top: 10px;

}

.sidebar-nav{
    padding: 0;
    margin-top: 15px;
    list-style: none;
}

.sidebar-nav li{
    text-indent: 20px;
    line-height: 40px;
}

.sidebar-nav li a{
    padding: 10px;
    display: block;
    text-decoration: none;
    color: #ddd;
}

.sidebar-nav li :hover{
    background: skyblue;
}
<!DOCTYPE html>
<html>
<head>
<title>Home page</title>

 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
     <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X R7YkIZDRvuzKMRqM OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="sidebar2.css" >

<style>
  #menu-toggle div {
  width: 20px;
  height: 2px;
  background-color: white;
  margin: 6px 0;
}
.sidebar-nav{
    height: 100%;
}
#a_logout{

}
</style>
</head>

<body>


  <div id="wrapper">
    <!--SideBar -->
    <div id="sidebar-wrapper">
        <h1 class='title-sidebar'>Welcome</h1>
        <h1 class='title-sidebar'>USER</h1>
         <ul >


            <li><a href="/" class='btn text-start'>HomePage</a></li>
            <li><a href="#" class='btn text-start'>View</a></li>
            <li><a href="/logout" id='a_logout' class='btn text-start' >Logout</a></li>


        </ul>
    </div>
     <!--Contents -->
    <div id="page-content-wrapper">
        <div >
            <div >
                <div >
                    <a href="#"  id="menu-toggle"><div></div>
                                                                        <div></div>
                                                                        <div></div></a>

                </div>
            </div>
        </div>
    </div>
</div>




<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqkt
iwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-Xe 8cL9oJa6tN/veChSP7q mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-kjU l4N0Yf4ZOJErLsIcvOU2qSb74wXpOhqTvwVx3OElZRweTnQ6d31fXEoRD1Jy" crossorigin="anonymous"></script>

<!-- Menu Toggle Script -->
<script>
    $("#menu-toggle").click( function(e){
        e.preventDefault();
        $("#wrapper.MenuDisplayed #page-content-wrapper").addClass("content-reverse");
        $("#wrapper.MenuDisplayed #sidebar-wrapper").addClass("wrapper-reverse");
        $("#wrapper").toggleClass("MenuDisplayed");
        
    });

</script>


<!-- Booststrap -->

</body>
</html>

How can I do it?

CodePudding user response:

Add

#a_logout{
  width: 100%;
  position: absolute;
  bottom: 0;
}

CodePudding user response:

  1. Add position:relative in <u>

  2. Add position: absolute in Log-out <li>

  3. Also Add top: calc(100vh - 12rem)

  • Related