本周,学习进度到CSS第三天,过渡应用,接下去要学习动画
CSS还有2天的课程
争取在下周可以完成
总结一下这周的收货:
CSS3的过渡和动画效果,可以很方便的取代JS
发布一下今天学习遇到的一个小技巧,用 position: relative 后,背景图片拉升,效果会维持现有位置。
<style>
<style>
* {
margin: 0;
padding: 0;
}
.bigger {
margin: 0 auto;
width: 200px;
height: 200px;
background-image: url(images/bg.jpg);
background-size: 100% auto;
transition: 2s;
background-position: center;
position: relative;
}
.bigger:hover {
background-size: 120% auto;
background-position: center;
}
</style>
</head>
<body>
<div class="bigger">
</div>
</body>
* {
margin: 0;
padding: 0;
}
.bigger {
margin: 0 auto;
width: 200px;
height: 200px;
background-image: url(images/bg.jpg);
background-size: 100% auto;
transition: 2s;
background-position: center;
position: relative;
}
.bigger:hover {
background-size: 120% auto;
background-position: center;
}
</style>
</head>
<body>
<div class="bigger">
</div>
</body>