Different CSS transition-delays for hover and mouseout?

前端 未结 3 1933
情书的邮戳
情书的邮戳 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

    /* These transition properties apply on "mouseout" */
    #bar { transition:height .5s ease-out 1s; } 
    
    /* These transition properties apply on hover */
    #bar:hover { transition:height .5s ease-out 0; }
    

    Just to say that this won't work if you do not enter 's' (seconds) symbol, so:

    /* These transition properties apply on "mouseout" */
    #bar { transition:height .5s ease-out 1s; } 
    
    /* These transition properties apply on hover */
    #bar:hover { transition:height .5s ease-out 0s; }   /* note "0s" */
    

提交回复
热议问题