Check the difference between (.class a:hover) vs (.class:hover a) - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover class

Description

Check the difference between (.class a:hover) vs (.class:hover a)

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">
.hvr,<!--from  w  w  w. j a  v  a  2 s  .c o m-->
.hvr2 {
   background:grey;
   padding:11px;
   margin:0 0 21px
}

.hvr:hover a {
   color:Chartreuse;
}

.hvr2 a:hover {
   color:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="hvr"> 
   <a href="#">link1: class2:hover a {}</a> 
   <div>
     Hover style for &lt;a&gt; will be triggered if .hvr div is hovered 
   </div> 
  </div> 
  <div class="hvr2"> 
   <a href="#">link2: .class2 a:hover {}</a> 
   <div>
     Hover style for a will only be triggered if &lt;a&gt; is hovered specifically 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials