Transition from 100% to auto

后端 未结 3 1751
醉话见心
醉话见心 2021-01-22 08:41

I have the following: http://jsfiddle.net/yHPTv/2491/

I was wondering why the transition isn\'t working? What it\'s supposed to do is slide in the hidden element (which

3条回答
  •  囚心锁ツ
    2021-01-22 08:51

    As you say you can't animate from % to auto. But to get the desire effect you can also use transform property. Try this:

    .block .hidden {
        background: red;
        padding: 3px 10px;
        position: absolute;
        bottom: 0;
        right: 0;
        transform:translateX(100%);
        transition: 1s;
    }
    
    .block:hover .hidden {
        transition: 1s;
        transform:translateX(0)
    }
    

    Check the Demo Fiddle

提交回复
热议问题