animation,transtion,transform,还有一种写法

395 阅读1分钟
#input{
    width: 100px;
    height: 100px;
    animation: 3s 3 ab; // 几秒 执行次数 执行函数
}
@keyframes ab{
    from{
        background-color: #fff;
    }
    to{
        background-color: #000;
    }
}

#input{
    width: 100px;
    height: 100px;
    transtion: .5s; // 该元素变化的时间是.5秒
}
#input:hover{
    width: 200px;
}

#input{
    width: 100px;
    height: 100px;
    transform: rotate(45deg); // 该元素外形位置初始变化
}

#input{
    width: 100px;
    height: 100px;
    transform: rotate(0deg);
    transtion: transform .5s; // 牛逼啊
}
#input:hover{
    transform: rotate(45deg);
    transtion: transform .5s;
}