animate using a background image from large to small

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<Title> css3 animation animation remains in the last one </ title>
<meta name="viewport" content="width=width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<style type="text/css">

  body{margin: 0;}
  .over{
     width: 1920px;
     height: 587px; 
	 overflow: hidden; // first overflow hidden
	 position: relative;
	 z-index: 1
    }
	
	.m-test{
	height: 587px; 
    animation: moveBackground 6s; // set animation time
    background: url ( "") center center; // you can define a background
    animation-fill-mode: forwards; // set animation stops at the last one
    }

    @-webkit-keyframes moveBackground {
      0% { transform: scale(1.1, 1.1);}
      100% { transform: scale(1, 1);}
    }
    @keyframes moveBackground {
      0% { transform: scale(1.1, 1.1);}
      100% { transform: scale(1, 1);}
    }  
</style>
</head>
<body>
<div class="over">
<div class="m-test"></div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script type="text/javascript">
</script>
</body>

</html>

  

Guess you like

Origin www.cnblogs.com/whl4835349/p/11713237.html