On hover of one div to change the color of another div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Color

Description

On hover of one div to change the color of another div

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

#b:hover ~ #a {
   background-color: #ccc;
}


      </style> 
 </head> <!--from ww  w  .  ja va 2s.c om-->
 <body> 
  <div id="b">
    Div B 
  </div> 
  <div>
    random other elements 
  </div> 
  <div>
    random other elements 
  </div> 
  <div>
    random other elements 
  </div> 
  <div id="a">
    Div A 
  </div>  
 </body>
</html>

Related Tutorials