Different CSS transition-delays for hover and mouseout?

前端 未结 3 1941
情书的邮戳
情书的邮戳 2020-12-13 06:32

Is it possible to use CSS3 transitions with a different delay switching between \"states\"? For example, I\'m trying to make an element immediately higher upon hover then on

3条回答
  •  甜味超标
    2020-12-13 07:04

    Here is a simplified JSFiddle example. Basically you need the transition-delay property:

    #transform {
        height:40px;
        width:40px;
        background-color:black;
        transition: .4s ease-out; 
        transition-delay: 2s;
        /*or shorthand: transition: .4s ease-out 2s;*/
    }
    
    #transform:hover {
        transition: .4s ease-out; 
        width:400px;
    }
    

提交回复
热议问题