css 鼠标经过图片缓慢切换图片、鼠标离开缓慢还原

时间:2022-06-12 19:17:25

https://blog.csdn.net/qq_26780317/article/details/80486766

 一.控制背景图片在一个圆形div内切换

.header .logo {
    width: 54px;
    height: 54px;
    margin:23px 0;
    text-align: center;
    border-radius: 54px;
    background: url("/static/images/icon/logo.png");
    border: #e38d13 solid;

    transition: all 0.6s;

}

    /* logo 水平反转 */
.header .logo:hover {
    background-position: -54px 0;

}

 二.控制div中的div上下切换

#user-operate .btn{
    margin-top: 0px;
    margin-left: -5px;
    transition: all 0.6s;
}

#user-operate .btn:hover {
  margin-top: -25px;
}