Transition for the border and background on hover - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Transition for the border and background 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">

div{<!--from w w  w  . j  a  v a  2  s . c o m-->
   background-color: blue;
   border: 4px solid blue;
   -webkit-transition: border-color 1s ease;
   -moz-transition: border-color 1s ease;
   -o-transition: border-color 1s ease;
   -ms-transition: border-color 1s ease;
   transition: border-color 1s ease;
}
div:hover{
   border-color: red;
   background: green;
}


      </style> 
 </head> 
 <body> 
  <div>
    Hi 
  </div>  
 </body>
</html>

Related Tutorials