CSS hover for after and before element - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover

Description

CSS hover for after and before element

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">
#box {<!--from www.j av a2 s .c o  m-->
   height:41px;
   width:100px;
   background:red;
}

#box:hover {
   background:blue;
}

#box:hover:after {
   border-top-color:Chartreuse;
}

#box:after {
   content:"";
   height:11px;
   position:absolute;
   width:0;
   margin-top:41px;
   margin-left:41px;
   border:11px solid yellow;
   border-top-color:blue;
}
</style> 
 </head> 
 <body> 
  <div id="box"></div>  
 </body>
</html>

Related Tutorials