Css3 background-position change without roll over - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Css3 background-position change without roll over

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">
#social-contacts {<!--from   ww  w . j  a v  a  2 s.  co  m-->
   width:376px;
   float:left;
   margin-left:51px;
   margin-top:100px;
}

#social-contacts li {
   float:left;
   list-style:none;
}

#social-contacts li a {
   display:block;
}

#fb a {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') 0 0;
   width:46px;
   height:46px;
   -webkit-transition:all 0.6s;
   -moz-transition:all 0.6s;
   -o-transition:all 0.6s;
   -ms-transition:all 0.6s;
   transition:all 0.6s;
   animation:animate_logo 3s;
   -moz-animation:animate_logo 3s;
   -webkit-animation:animate_logo 3s;
   -o-animation:animate_logo 3s;
   animation-iteration-count:infinite;
}

@keyframes animate_logo  {
   from {
      opacity:0.9;
   }
   
   to {
      background-position:0 48px;
      opacity:2;
   }

}

@-moz-keyframes animate_logo   {
   from {
      opacity:0.9;
   }
   
   to {
      background-position:0 48px;
      opacity:2;
   }

}

@-webkit-keyframes animate_logo   {
   from {
      opacity:0.9;
   }
   
   to {
      background-position:0 48px;
      opacity:2;
   }

}

@-o-keyframes animate_logo   {
   from {
      opacity:0.9;
   }
   
   to {
      background-position:0 48px;
      opacity:2;
   }

}
</style> 
 </head> 
 <body> 
  <div id="social-contacts"> 
   <ul> 
    <li id="fb"> <a href=""></a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials