How do I apply CSS3 transition to all properties except background-position?

前端 未结 6 1722
傲寒
傲寒 2020-12-13 08:26

I\'d like to apply a CSS transition to all properties apart from background-position. I tried to do it this way:

.csstransitions a {
    -webkit-transition:          


        
6条回答
  •  清歌不尽
    2020-12-13 09:04

    For anyone looks for a shorthand way, to add transition for all properties except for one specific property with delay, be aware of there're differences among even modern browsers.

    A simple demo below shows the difference. Check out full code

    div:hover {
      width: 500px;
      height: 500px;
      border-radius: 0;
      transition: all 2s, border-radius 2s 4s;
    }
    

    Chrome will "combine" the two animation (which is like I expect), like below:

    While Safari "separates" it (which may not be expected):

    A more compatible way is that you assign the specific transition for specific property, if you have a delay for one of them.

提交回复
热议问题