What is the difference between applying CSS transition property in hover rather than in its normal state?

前端 未结 4 560
一个人的身影
一个人的身影 2020-12-11 12:19

I\'m learning CSS3. Now, what I\'ve seen in w3schools website is that:

CSS

#ID {
  transition: transform 3s;
}

#ID:hover {
  transf         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 12:39

    1st case :

    All your transition in the #ID will have a transition of 3s. When you hover your #ID, your transformation is rotateX(20deg).

    2nd case :

    When you hover your #ID, you have a transition of 3s.

    Overall :

    All the transitions from the first css will have a duration of 3s. Then you can apply transitions on your #ID from different places. Whereas in your second case you separate them and if you want to have another transitions triggerd by something else than hover, you will have to specify the duration again.

    Both are correct

提交回复
热议问题