Css:- Background image animation


The background-size property specifies the size of the background images. 
In this example we are change the background-size using keyframes.



Code:-


<!DOCTYPE html> 
<html> 

<head> 
 <meta name="viewport" content="width=device-width, initial-scale=1"> 

 <style> 
  #anbody { 
   background-image: url(star.png); 
   animation: animation_name 8s infinite; 
  } 
   
  @-webkit-keyframes animation_name { 
   from { 
    background-size: 0px 0px; 
   } 
   to { 
    background-size: 150px 150px; 
   } 
  } 
   
  @keyframes animation_name { 
   from { 
    background-size: 0px 0px; 
   } 
   to { 
    background-size: 150px 150px; 
   } 
  } 
 </style> 

</head> 

<body id="anbody"> 
 Some text 
</body> 

</html>
Css:- Background image animation Css:- Background image animation Reviewed by Network security on May 13, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.