1 | < code ><!DOCTYPE html>< br >< html >< br >< head >< br > < title >CSS过渡实现背景位置渐变</ title >< br > < style >< br > .box {< br > width: 200px;< br > height: 200px;< br > background-color: red;< br > transition: background-position 1s;< br > }< br > </ style >< br ></ head >< br >< body >< br > < div class = "box" ></ div >< br ></ body >< br ></ html ></ code > |
1 | < code >.box {<br> width : 200px ;<br> height : 200px ;<br> background-color : red ;<br> transition: background-position 1 s;<br>}<br>.box:hover {<br> background-position : -100px -100px ;<br>}</ code > |
本文为翻滚的胖子原创文章,转载无需和我联系,但请注明来自猿教程iskeys.com