Style div with hover and active state - Javascript jQuery

Javascript examples for jQuery:CSS

Description

Style div with hover and active state

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <style id="compiled-css" type="text/css">

div {//w  w w.j  ava 2s  . c  o  m
   background-color:#fff;
}
div:hover:active {
   background-color:#000;
}
div:hover {
   background-color:#f00;
}


      </style> 
 </head> 
 <body> 
  <div>
    test 
  </div>  
 </body>
</html>

Related Tutorials