HOVER to change two divs - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover to change

Description

HOVER to change two divs

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">
#div1 {<!-- ww  w  .j  a va 2s  .  com-->
   position:relative;
   background:red;
   width:401px;
   height:401px;
   line-height:201px;
   border-radius:201px;
   text-align:center;
   font-size:25px;
}

#div1:hover {
   background:blue;
}

#div2 {
   position:absolute;
   background:blue;
   top:100px;
   left:100px;
   width:201px;
   height:201px;
   background-color:Chartreuse;
}

#div1:hover #div2 {
   color:yellow;
}
</style> 
 </head> 
 <body> 
  <div id="div1"> 
   <div id="div2">
     Lor 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials