CSS3 实现图片上浮动画(转载)

CSS3 实现图片上浮动画 

.gist {
    width:220px;
    height:130px;
    background-image: url(2.jpg);
    background-repeat:no-repeat;
    border:5px solid green;
    background-position:50% 50%;
    transition:background-position 2s;
    -moz-transition:background-position 2s; /* Firefox 4 */
    -webkit-transition:background-position 2s; /* Safari and Chrome */
    -o-transition:background-position 2s; /* Opera */
}
 
.gist:hover {
  background-position: 50% -100px;
}
图片水平垂直居中: background-position:50% 50%;

转载于:https://www.cnblogs.com/hephec/p/5493757.html

你可能感兴趣的:(CSS3 实现图片上浮动画(转载))