Vertical scrolling nav inside a variable height container - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav Bar

Description

Vertical scrolling nav inside a variable height container

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
body {<!--from  w  w  w.  j  av  a 2s.  c  om-->
   height:100%;
   width:100%;
   margin:0;
}

nav {
   background-color:Chartreuse;
   width:301px;
   height:100%;
   position:fixed;
}

nav .user {
   height:51%;
   text-align:center;
}

nav .user img {
   height:100%;
}

nav .links-wrap {
   height:51%;
   overflow:scroll;
}

nav ul.links {
   list-style:none;
   margin:0;
   padding:0;
}

nav ul.links li {
   height:61px;
}

nav ul.links li a {
   display:block;
   line-height:61px;
   vertical-align:middle;
   padding-left:41px;
   box-sizing:border-box;
   transition:all .4s ease;
   color:yellow;
   text-decoration:none;
   fotn-family:sans-serif;
}

nav ul.links li a:hover:not(.current) {
   background-color:blue;
   padding-left:46px;
   color:pink;
}
</style> 
 </head> 
 <body translate="no"> 
  <nav role="navigation"> 
   <div class="user"> 
    <img src="https://www.java2s.com/style/demo/Opera.png"> 
   </div> 
   <div class="links-wrap"> 
    <ul class="links"> 
     <li> <a href="#">Lore</a> </li> 
     <li> <a href="#">Lorem</a> </li> 
     <li> <a href="#">Lorem i</a> </li> 
     <li> <a href="#">Lorem ipsu</a> </li> 
     <li> <a href="#">Lorem ipsu</a> </li> 
     <li> <a href="#">Lorem ipsu</a> </li> 
     <li> <a href="#">Lorem ipsu</a> </li> 
     <li> <a href="#">Lorem ipsu</a> </li> 
     <li> <a href="#">Lorem i</a> </li> 
     <li> <a href="#">Lorem i</a> </li> 
    </ul> 
   </div> 
  </nav>  
 </body>
</html>

Related Tutorials