Apply style from start to the hovered element with :not(:last-child) - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover

Description

Apply style from start to the hovered element with :not(:last-child)

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">
span {<!--   w  ww.  ja v a2s.  c o  m-->
   display:inline-block;
   outline:2px solid red;
   padding:6px;
}

span>i {
   float:right;
   height:21px;
   width:21px;
   outline:2px solid blue;
   cursor:pointer;
}

span>i:not(:last-child) {
   margin-left:11px;
}

span>i:hover, span>i:hover~i {
   background-color:Chartreuse;
}
</style> 
 </head> 
 <body> 
  <span> <i></i> <i></i> <i></i> <i></i> <i></i> </span>  
 </body>
</html>

Related Tutorials