CSS Transition for only one type of transform?

前端 未结 4 1745
温柔的废话
温柔的废话 2020-12-09 14:27

Is it possible to animate (using transitions) only one type of css transform?

I have css:

cell{
  transform: scale(2) translate(100px, 200px);
  tran         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 15:02

    No! you cannot use transition only for certain value of transform like scale(2).

    One possible solution would be as follows: (sorry, you have to use additional html)

    HTML

    Hello World

    CSS

    div.scale:hover {
        transform: scale(2);
        transition: transform 0.25s;
    }
    div.scale:hover div.translate {
        transform: translate(100px,200px);
    }
    

提交回复
热议问题