make 2 different spans change color on hover - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Color

Description

make 2 different spans change color on hover

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

#container<!--from w  w w .  j  a va  2 s .com-->
{
   background-color: white;
}
#container:hover .type1
{
   color: red;
}


      </style> 
 </head> 
 <body> 
  <div id="container"> 
   <span class="type1">Blah</span> 
   <span class="type2">Foo</span> 
   <span class="type1">Blah</span> 
  </div>  
 </body>
</html>

Related Tutorials