Spin or rotate an image on hover

前端 未结 5 558
庸人自扰
庸人自扰 2020-11-27 15:30

I want to find out how to make a spinning or rotating image when it is hovered. I would like to know how to emulate that functionality with CSS on

5条回答
  •  感动是毒
    2020-11-27 15:56

    here is the automatic spin and rotating zoom effect using css3

    #obj1{
        float:right;
        width: 96px;
        height: 100px;
        -webkit-animation: mymove 20s infinite; /* Chrome, Safari, Opera */
        animation: mymove 20s infinite;
        animation-delay:2s;
        background-image:url("obj1.png");
        transform: scale(1.5);
        -moz-transform: scale(1.5);
        -webkit-transform: scale(1.5);
        -o-transform: scale(1.5);
        -ms-transform: scale(1.5); /* IE 9 */
        margin-bottom: 70px;
    }
    
    #obj2{
        float:right;
        width: 96px;
        height: 100px;
        -webkit-animation: mymove 20s infinite; /* Chrome, Safari, Opera */
        animation: mymove 20s infinite;
        animation-delay:2s;
        background-image:url("obj2.png");
        transform: scale(1.5);
        -moz-transform: scale(1.5);
        -webkit-transform: scale(1.5);
        -o-transform: scale(1.5);
        -ms-transform: scale(1.5); /* IE 9 */
        margin-bottom: 70px;
    }
    
    #obj6{
        float:right;
        width: 96px;
        height: 100px;
        -webkit-animation: mymove 20s infinite; /* Chrome, Safari, Opera */
        animation: mymove 20s infinite;
        animation-delay:2s;
        background-image:url("obj6.png");
        transform: scale(1.5);
        -moz-transform: scale(1.5);
        -webkit-transform: scale(1.5);
        -o-transform: scale(1.5);
        -ms-transform: scale(1.5); /* IE 9 */
        margin-bottom: 70px;
    }
    
    /* Standard syntax */
    @keyframes mymove {
        50% {transform: rotate(30deg);
    }
    









    Here is the demo

提交回复
热议问题