Positioning and Aligning Objects in Navbar CSS/HTML - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Positioning and Aligning Objects in Navbar CSS/HTML

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
ul {<!--from w  w w  .j  a v a  2 s .  co  m-->
   list-style-type:none;
   margin:0;
   padding:0;
   overflow:hidden;
}

li {
   float:right;
   margin-left:7px;
}

li a {
   display:block;
   color:Chartreuse;
   text-align:center;
   padding:15px 17px;
   text-decoration:none;
}

a:hover:not(.active) {
   background-color:yellow;
}

#mySidenav a {
   position:relative;
   transition:0.4s;
   padding:16px;
   width:121px;
   color:blue;
   border-radius:100px 0 0 11px;
   text-align:right;
   text-decoration:none;
   font-family:'Quicksand', sans-serif;
   font-size:21px;
   -ms-transform:rotate(0deg);
   -webkit-transform:rotate(0deg);
   transform:rotate(0deg);
}

#mySidenav a:hover {
   right:0;
   -ms-transform:rotate(361deg);
   -webkit-transform:rotate(361deg);
   transform:rotate(361deg);
}

#about {
   background-color:pink;
}

#blog {
   background-color:OrangeRed;
}

#projects {
   background-color:grey;
}

#contact {
   background-color:BlueViolet;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <div id="mySidenav"> 
    <ul> 
     <li> <a href="#" id="about">Lorem</a> </li> 
     <li> <a href="#" id="blog">Lore</a> </li> 
     <li> <a href="#" id="projects">Lorem ip</a> </li> 
     <li> <a href="#" id="contact">Lorem i</a> </li> 
    </ul> 
   </div> 
  </nav>  
 </body>
</html>

Related Tutorials