本週,學習進度到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>