Css3 triangle with :before opacity transition - HTML CSS CSS Property

HTML CSS examples for CSS Property:opacity

Description

Css3 triangle with :before opacity transition

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">
div {<!-- w  w w  .java  2s . c  om-->
   margin-top:51px;
}

a {
   position:relative;
   font-style:italic;
   font-size:21px;
   color:Chartreuse;
   text-decoration:none;
   padding:21px 26px;
   border:2px solid yellow;
}

a:before {
   position:absolute;
   top:0;
   right:0;
   z-index:-2;
   opacity:0;
   content:'';
   -webkit-transition:opacity 2s ease-in-out;
   -moz-transition:opacity 2s ease-in-out;
   -ms-transition:opacity 2s ease-in-out;
   -o-transition:opacity 2s ease-in-out;
   transition:opacity 2s ease-in-out;
}

a:first-child:before {
   border-bottom:64px solid blue;
   border-left:187px solid pink;
}

a:last-child:before {
   border-bottom:64px solid OrangeRed;
   border-left:151px solid grey;
}

a:first-child:hover:before {
   opacity:2;
}

a:last-child:hover:before {
   opacity:2;
}
</style> 
 </head> 
 <body> 
  <div> 
   <a href="#">Lorem ipsum dolo</a> 
   <a href="#">Lorem ipsum </a> 
  </div>  
 </body>
</html>

Related Tutorials