Keep active link color - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:active

Description

Keep active link color

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">

#nav_container {<!--from   w w w  . j  a v a 2  s . co m-->
   height: 36px;
   width: 100%;
   background: #27336f;
   margin: 0 0 10px 0;
}
#nav {
   float: left;
   height: 100%;
   width: auto;
   margin: 0;
   padding: 0;
   list-style: none;
   position: relative;
   z-index: 5;
}
#nav li {
   float: left;
   height: 100%;
   width: auto;
   display: inline;
   padding: 0;
   text-transform: uppercase;
   position: relative;
}
#nav a {
   display: block;
   height: 16px;
   width: auto;
   padding: 10px 10px 10px 10px;
   color: white;
   text-decoration: none;
}
#nav a:hover {
   background: #E8F4Fb;
   color: #000;
}
#nav li:hover ul{
   left: 0px;
}
#nav li:hover{
   background: #E8F4Fb;
}
#nav li:hover a { color: black; }
#nav li:hover ul a{
   background: #E8F4Fb;
   text-decoration: none;
   color: black;
}
#nav li:hover ul li a:hover{
   background: blue;
}
#nav ul {
   list-style: none;
   position: absolute;
   left: -9999px; /* hide off-screen */
   border-left: 1px solid blue;
   border-bottom: 1px solid blue;
   border-right: 1px solid blue;
}
#nav ul li{
   padding-top: 0;
   float: none;
}
#nav ul li a{
   white-space: nowrap;
}


      </style> 
 </head> 
 <body> 
  <div id="nav_container"> 
   <ul id="nav"> 
    <li> <a href="#">Home</a> </li> 
    <li> <a href="#">About Us</a> 
     <ul> 
      <li> <a href="#">Location</a> </li> 
     </ul> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials