Hover over one list element, affect a div Only CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover on list

Description

Hover over one list element, affect a div Only CSS

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">
.centermenu {<!--   w w  w  .jav  a  2  s  .  co m-->
   background-color:Chartreuse;
   position:relative;
   float:left;
   width:1001px;
   margin-top:71px;
   margin-left:41px;
   border:2px solid yellow;
   height:auto;
   color:blue;
   word-wrap:break-word;
}

p {
   padding:6px;
   text-indent:11px;
}

.tohover>a {
   color:pink;
}

#m1:hover~.centermenu:before {
   background-color:OrangeRed;
   content:"Lorem ipsum";
}

#m1:hover~.centermenu {
   color:grey;
}
</style> 
 </head> 
 <body> 
  <div class="parent"> 
   <div class="tohover" id="m1"> 
    <a href="#">Lore</a> 
   </div> 
   <div class="tohover" id="m2"> 
    <a href="#">Lore</a> 
   </div> 
   <div class="tohover" id="m3"> 
    <a href="#">Lorem </a> 
   </div> 
   <div class="tohover" id="m4"> 
    <a href="#">Lorem </a> 
   </div> 
   <div class="centermenu"> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in,</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials